Page 1 of 1

make a delete code

Posted: Wed Dec 23, 2009 12:51 pm
by M.K_Soft
hi dears.
i have a name in mysql and i wrote this code for delete a row:

<form id="form1" name="form1" method="get" action="Delete.php"><input type="submit" name="<?php echo $name=$row["name"]; ?>" value="Delete" /></form>

i use session in my pages.
in the statistic.php, i show infos and in the delete.php i wanna delete a complete recore for example "where name= M.K_Soft". i can i distinguish the name in the code above and send it to the delete page so that i delete it?

but it doesn't work.
i just wanna send the name in the Delete.php and there i delete it and also back to the statistics.php.

please help me.
thanke you in advance.

Re: make a delete code

Posted: Wed Dec 23, 2009 3:33 pm
by daedalus__
buddy you need to post more code. what are you using to delete the record?

also this works:

Code: Select all

 
echo $name=$row["name"];
 
but im going to say that it is wrong. why would you assign a value to a variable and then immediately echo it? do you use it in another place in the page? and if you do then why not declare in another place where it is easier to keep track of it?

Re: make a delete code

Posted: Wed Dec 23, 2009 4:21 pm
by M.K_Soft
daedalus__ wrote:buddy you need to post more code. what are you using to delete the record?

also this works:

Code: Select all

 
echo $name=$row["name"];
 
but im going to say that it is wrong. why would you assign a value to a variable and then immediately echo it? do you use it in another place in the page? and if you do then why not declare in another place where it is easier to keep track of it?
hi dear. so appreciate to reply so soon.
i echo that to see it in the next page. i think i just need the name to reove all it's row from the table.
actually, i have a table named "stdb" and one of it's row is "name". i wanna send the "name" parameter to a page called delete. then delete the row which has this para meter and then delete the row.
if there is a better way, please assist me.
thanks.