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
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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.