Jump to content

Archived

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

christo

Passing value / SQL

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

Share this post


Link to post
Share on other sites
See

[a href=\"http://www.phpfreaks.com/forums/index.php?act=ST&f=1&t=92933&hl=&view=findpost&p=371960\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?...ndpost&p=371960[/a]

Share this post


Link to post
Share on other sites
hmm i don't understand your point !
Myself i send data via post and it should work normally, do you mean i should try $_REQUEST (i tried it) the isset thing is no use for me...or maybe i don't see what you're trying to explaing me :( Can you be more clear ?

christos

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

×

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.