Jump to content

Passing value / SQL


christo

Recommended Posts

This time from scrip1.php i need to press a button and it will send a value (number) to another script2.php that will erase a row from the DB

so at script1.php i have :[code] echo "    </table><br>
<td><form method=post action=upd_obj.php>
<input type=submit value='Modifier une annonce '> N°:
<input type=text name=objid size=1></form></td>";[/code]

//the value i need to sent is objid...a box next to N

and at script2.php :[code] $objid = $HTTP_POST_VARS['objid']; // in order to bring the value submited by post...at thisline a get the Notice too :(

//conncetion with DB

$query="DELETE * FROM  object WHERE objid=$objid";
$resultat=mysql_query($query); [/code]

The message i get...
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Notice: Undefined index: objid in c:\foreign\easyphp1-8\www\agence\test\del_obj.php on line 21[/quote]

what have i done wrong, any ideas ???

Christos
Link to comment
https://forums.phpfreaks.com/topic/9237-passing-value-sql/
Share on other sites

K problem sorted but there is another one :)

I manage to pass the value but it won't delete the row from the DB...
[code]$objid = $HTTP_POST_VARS['objid'];

echo"objid=$objid";

//connection

$db_conx = mysql_connect($host,$user,$pass) or print("error de connection mysql");
mysql_select_db($base, $db_conx) or print("error connection base");


$query="DELETE * FROM object WHERE objid=$objid";
$resultat=mysql_query($query);

if ($resultat) {
echo"deleted !";
}
else {
echo" problem !";
}

My request seems ok,right?
Link to comment
https://forums.phpfreaks.com/topic/9237-passing-value-sql/#findComment-34064
Share on other sites

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.