Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdownbox value +delete weeks

Status
Not open for further replies.

TanTrazz

Programmer
Aug 18, 2001
54
NL
Hi all,


Ive made a script to delete data from a table depending on the week number.

The weeknumbers are stored in the database.

This is the script:

if ($deleteweken==1)
mysql_unbuffered_query("DELETE * FROM test WHERE weeknummer = '".$_GET['weeknummer']."'");

<select name="weeknummer" id="weeknummer">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>


The Link is : <a target="_self" href="verdachtgedrag.php?deleteweken=1">[ Delete ]</a>

The problem is it wont delete anything

What did i do wrong?

TnQ TanTrazz
 
Huh, your problem is more html based than php. The thing is, that the value from the select box does not get sent. Values from <select> boxes are only sent when form is submitted or a script (JavaScript) submits that value. What you are doing is just providing a link to next page, where your sql sentence fails because weeknummer was not sent. Try to make a form with the button, that will make the whole script much easier. You can check at the beginning if the button was pressed or not, the same way you are currently testing if deleteweken is set or not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top