POST not working...form within a form???
Posted 30 September 2006 - 11:11 PM
It is not working. I think the problem may be that due to the structure of the HTML, I have a form within a form. Is this allowed??
I have a table within a table, and one form is in this table. The larger table has it's own form elements.
I am thinking of just removing the table within the table and replacing it with a DIV that is positioned in the same place. That way, the DIV can be anywhere in the HTML and won't be within another form.
Any other ideas to solve this????
Posted 30 September 2006 - 11:18 PM
why is it such that there is a form within a form?
Posted 30 September 2006 - 11:29 PM
I have dynamically generated delete buttons. One for each entry in my database. In order to get the delete buttons to work I need to make each within it's own form. When they are not within their own form they don't work...I'm not sure why. I think because some of the data that is being deleted is also dynamic and shares the same field name as other records. Anyway, the way this is layed out is ina scetion of my page where there are other form fields and the flow of the HTML has these delete forms within the main form for the page.
I think I can structure it so theres no form within a form, I'll just have to use more than 1 for the main page. Just chop it in 2 with the delete forms in the middle...this should work...
Posted 30 September 2006 - 11:38 PM
When the submit button is clicked, delete all records that were checked.
Display the record as a link. Assume for a minute that you want to delete a user. userID is unique. So your link could look like:
Then deleteuser.php would retrieve the userID from the Get array.
Personal, I'd prefer the first suggestion. If you had multiple records to delete you could just check them all. The second one would require you to keep clicking the links.
Posted 30 September 2006 - 11:51 PM
there are a few ways around this:
first of all, as you said, each delete button and its related record can go into their own form. to do this, you need to ensure that each form contains only its relevant record and its delete button. each record must have an opening and closing form tag of its own.
another option is to make a checkbox for each record. this way not only can the user delete as many as they want without having to constantly press a button for each, but you can nestle all of the records into one form. simply do something like this:
<input type="checkbox" name="delete" value="record1"> <input type="checkbox" name="delete" value="record2">
you will then be given an array of record values in the form:
$_POST['delete'] => 'record1'
so you merely need to do a foreach() loop through $_POST['delete'] to get all the records the user chose to delete.
EDIT: doni beat me to it. i'll leave this here just as an explanation for why the form isn't working.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users