Jump to content

Delete form entry from second table


NoDoze

Recommended Posts

This is what I have so far:
[code]
<select name="project_number" class="txtbox">
  <option value="1" selected></option>
<?php
$result = mysql_query("SELECT * FROM projnum");
while($row = mysql_fetch_array($result))
{
    echo '<option value="' . $row['project_number'] . '"> ' . $row['project_number'] . "</option>\n  ";
}

mysql_query("DELETE FROM projnum WHERE project_number = 'project_number'");

?>
</select>
[/code]

This is used in a form so that the same projects numbers aren't used twice.
I have one table containing all the form entries, including the submited 'to be' active project number.
And a second table with just the inactive project numbers. It is this inactive project number list where the chosen project number has to be delete from so thatit doesn't appear in the pull down list anymore.

This is the last thing I have to do with this form, so it's become a stickler...
I'd show you the web page, but it's for an intranet site...

I got help with this in another post for the first part, but I don't think it was clear for the second part...I'm hopeing this explaination is clearer...

Thanks!
Link to comment
https://forums.phpfreaks.com/topic/28786-delete-form-entry-from-second-table/
Share on other sites

The project number list is appearing in the form in a pull down list so that users can see what project numbers are available.
When a project number is used, it needs to be remove from this pull down list so that it isn't used again.

The form is being submited to one table, and the project numbers are being pulled (for the form) from a different table. So that once the form is submited, the project number gets input into the first table.

Does that clarify?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.