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
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
Link to comment
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
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.