[newbie] passing variables
| From: | pjc | Date: | Tue, 20 Nov 2001 00:59:51 +0000 |
| Subject: | [newbie] passing variables | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-db+get-14450@lists.php.net to get a copy of this message | ||
I just started playing with PHP and MySQL and am building an online
phonebook for myself.
From my 'view_all_numbers.php' I have a link that looks something like this:
<a
href="delete_entry_confirm.php?first=yourfirstname&last=yourlastname">DELETE
</a>
Here is the code from delete_entry_confirm.php
<?
echo "<h3 align=center>Are you sure you want to delete <br>";
echo "<i>".$first." ".$last."</i>";
echo "<br>from the phonebook?</h3>\n\n";
echo "<form action='delete_entry.php' action='get'>\n";
echo "\t <input type='hidden' name='first'
value='".stripslashes($first)."'>\n";
echo "\t <input type='hidden' name='first'
value='".stripslashes($last)."'>\n";
echo "<input type=submit value='Delete This Entry'>";
echo " <input type=button value='I would rather keep it...'
onclick='javascript:history.back();'>";
echo "</form>";
?>
=======================================================
And here's the code from my delete_entry.php
<?
if(!$last || !$first) {
echo "<h4 align=center>Something's fucked up with yo script ya
herd...</h4>";
exit;
}
$db = @mysql_connect("localhost","login","pass");
if (!$db)
{
echo "<b>Database ain't workin dawg!!</b>";
exit;
}
mysql_select_db("paultest");
$query = "delete from phonebook where last='".$last."' and
first='".$first."'";
$result = mysql_query($query);
if($result)
echo "<h3>".mysql_affected_rows()." record(s) deleted.</h3>";
?>
=======================================================
This link does work though: <a
href="delete_entry.php?first=yourfirstname&last=yourlastname">YES I WANT TO
DELETE</a>
The error that I am getting on delete_entry.php is that my variables aren't
there. Any suggestions folks?
Thank you in advance.
-p
--
Paul C
boogieman20@hotmail.com
ICQ:68274240
"You can't put a bag over someone's personality."