Page 1 of 1
Confirming record delete
Posted: Wed Feb 11, 2004 10:56 pm
by Illusionist
can someone tell me whats wrong with this? I'm trignt o maek a confirmation page to check if the user actually wants to delete teh file or not, and im having a little trouble:
Code: Select all
echo "<center>";
echo "<b>Are you sure you want to delete $file?</b><br/>";
echo "<form action=edit.php?file=$file&action=delete method=get><input type=hidden name=yn value=no><input type=submit value=No></form>";
echo "<form action=edit.php?file=$file&action=delete method=get><input type=hidden name=yn value=yes><input type=submit value=Yes></form>";
echo "</center>";
Thanks
Posted: Wed Feb 11, 2004 11:52 pm
by John Cartwright
What kind of errors, if any are you getting? Provide us with more information, such as edit.php.
Posted: Wed Feb 11, 2004 11:58 pm
by Illusionist
well... i dont get any errors... when i click one fo the submit buttons it atually takes me to edit.php?yn=yes or edit.php?yn=no
Posted: Thu Feb 12, 2004 12:30 am
by John Cartwright
What the problem then
Posted: Thu Feb 12, 2004 1:37 am
by greenhorn666
You can't use the get method...
If you provide params on the action, use a post (which is in this case more appropriate anyhow, won't let the user bookmark for instance)
And be a good programmer (or HTML author rather) use quotes (") for your tag's attributes!
And you should url_encode($file) too, you can't rely on the browser to do that for you...
Posted: Thu Feb 12, 2004 11:11 am
by Illusionist
Phenom wrote:What the problem then
It supposed to go to
edit.php?file=$file&action=delete&yn=yes
not
edit.php?yn=yes
Re: double submits?!
Posted: Thu Feb 12, 2004 12:25 pm
by tsg
You should use hidden tags also for the $file and $action ... not in the URL.
Posted: Thu Feb 12, 2004 2:56 pm
by Illusionist
don't matter i got it fixed. Just liek i wanted it...
Posted: Thu Feb 12, 2004 4:36 pm
by d3ad1ysp0rk
Code: Select all
echo <<<EOT
<b>Are you sure you want to delete $file?</b><br />
<a href="edit.php?file=$file&action=delete&yn=no">No</a>
<a href="edit.php?file=$file&action=delete&yn=yes">Yes</a>
EOT;
Posted: Thu Feb 12, 2004 5:29 pm
by Illusionist
LiLpunkSkateR, thanks but i figured it out already and i didn't want to use links anyways.. thanks
Posted: Thu Feb 12, 2004 5:35 pm
by d3ad1ysp0rk
then..
Code: Select all
<?php
echo <<EOT
<b>Are you sure you want to delete $file?</b><br />
<form action="edit.php" method="get">
<input type="hidden" name="yn" value="no">
<input type="hidden" name="file" value="$file">
<input type="hidden" name="action" value="delete">
<input type="submit" value="No">
</form>
<form action="edit.php" method="get">
<input type="hidden" name="file" value="$file">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="yn" value="yes">
<input type="submit" value="Yes">
</form>
EOT;
?>
and just a Q, why no links? You could always use an image for the link (ie. <a><img></a>) if you want a button instead of text..
Posted: Thu Feb 12, 2004 5:44 pm
by Illusionist
like i said, LiLpunkSkateR, thanks for the help, but i figured it out already. no links because i said!
Posted: Thu Feb 12, 2004 6:14 pm
by Illusionist
i'm sorry, Phenom, let put it behind us get over it, deal?
Posted: Thu Feb 12, 2004 6:14 pm
by d3ad1ysp0rk
Illusionist wrote:like i said, LiLpunkSkateR, thanks for the help, but i figured it out already. no links because i said!
- It's good to post the solution if others have the same problem
- Good reason for no having links..
Posted: Fri Feb 13, 2004 9:24 am
by twigletmac
I have deleted a load of trash out of this thread because flame wars are a waste of bandwidth. In future consider sorting out your differences via the PM system so the rest of us don't have to read that sort of twaddle.
Mac