Re: [newbie] passing variables
| From: | Russ Michell | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: [newbie] passing variables | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-db+get-14456@lists.php.net to get a copy of this message | ||
I can see a few bodges:
1). > echo "<form action='delete_entry.php' action='get'>\n";
should be: echo "<form method='get'
action='delete_entry.php'>\n";
2). You have two vars named the 'first' but with different values:
> echo "\t <input type='hidden' name='first'
> value='".stripslashes($first)."'>\n";
> echo "\t <input type='hidden' name='first'
> value='".stripslashes($last)."'>\n";
3). Careful what you print in your posts, some may find it offensive:
> echo "<h4 align=center>Something's fucked up with yo script ya
> herd...</h4>";
HTH
Russ
On Mon, 19 Nov 2001 16:59:51 -0800 pjc <boogieman20@hotmail.com> wrote:
> 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."
>
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: r.j.michell@apu.ac.uk
w: www.apu.ac.uk/webteam
www.theruss.com
#-------------------------------------------------------#