![]() |
Confused within forms
PHP Code:
Question ID#1 - Question here 1st Choice: For - 2nd Choice: Against - 3rd Choice: No choice - Edit Choices:radiobox Question ID#2 - Question here 1st Choice: For - 2nd Choice: Against - 3rd Choice: No choice - Edit Choices:radiobox Question ID#3 - Question here 1st Choice: For - 2nd Choice: Against - 3rd Choice: No choice - Edit Choices:radiobox Delete: checkbox - Edit: radiobox Delete Button Edit Button Edit Choices Button The delete button works perfectly. However when an question or a question choices are selected to be edited from the radio boxes. It doesn't shows the results in the end. delete_edit_questions.php file: PHP Code:
|
Could you be a bit more specific as to what isn't working? So for example, say I select a question and then select edit choices. Are you saying that it isn't showing the data for the choices? If so, then that will be cause you need to get that data from the database using the ID you've passed through $_POST['edit_choices'].
On another note, there are also a few variable assignments to $_POST variables that have not been validated. This is generally a bad idea, but for simplicity, you could just ignore the error using @. Here are the ones I noticed: 1 near the top: $submit_delete = @$_POST['delete']; and these 3 near the bottom: $submit_new_question = @$_POST['submit_new_question']; $new_question = @$_POST['new_question']; $edit_ID = @$_POST['selected_edit_q']; |
Quote:
In the delete_edit_questions.php, there are forms for both of the cases. Edit_choice case PHP Code:
PHP Code:
|
Ok, seems like you've got yourself in a muddle, try the following:
Find the line: PHP Code:
PHP Code:
|
Yeah, it fixed it. Why? :O
|
The reason why is because when you first submit the form you send two specific POST vars along with it, edit_choices (containing the ID) and edit_choice, which you used to specify the action.
However, on the edit choice page you didn't resend the edit_choice or edit_choices when you resubmitted the form, therefor the following condition failed: PHP Code:
PHP Code:
Replace the following line: PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
| All times are GMT. The time now is 03:59 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0