Hello, I have an html form button that has been deleted. Next to the button is an input field, enter the number corresponding to the logged User ID, and then press Delete.
For some reason this does not work.
This is my html form:
& lt; H3 class = "block-head" & gt; Delete Job & lt; / H3 & gt; & Lt; Form action = "deletejob.php" method = "post" class = "original-gray" & gt; & Lt; Label & gt; Please enter job id & lt; / Labels & gt; & Lt; Input type = "text" name = "idnum" id = "id" /> & Lt; Br> & Lt; Input type = "submit" name = "delete" value = "delete" /> & Lt; / Form & gt;
This is my php code:
mysql_connect ("********", "root", "***** * ") Or die (" connection failure "); Mysql_select_db ("Jobs List") or Die ("Connection Failed"); $ Idnum = $ _POST ['id']; Remove $ Query = "jobs_list where idnum = '". $ Id "'"; If (mysql_query ($ query)) {echo "deleted";} else {echo "fail";}
I know about mysqli and switching on it ... I Just want to see if this method works first.
Thank you.
Your input name is idnum
yet you $ _ Looking for POST
in ID
and looking at your query using the variable $ id
You can see the $ idnum < / Code>.
$ idnum = intval ($ _ POST ['idnum']); Remove $ Query = "jobs_list where idnum = '". $ Idnum. "'";
No comments:
Post a Comment