[PHP] Trying to pass a variable through a form...

2001-12-07 Thread Bryant Brabson

Your homework is finished!

TonyForm.html:
HTML
FORM ACTION=Tony1.php  METHOD=post
Name: INPUT TYPE=text NAME=lname br
INPUT TYPE=Submit  VALUE=Go
/FORM
/HTML

tony1.php
?
 $lname = $HTTP_POST_VARS['lname'];
?
html
body
?
echo (Welcome $lname);
?
A HREF=Tony2.php?name=?echo($lname) ? Link /A
/body
/html

tony2.php
?
 $name = $HTTP_GET_VARS['name'];
?
html
body
?
echo (Hello $name);
?
/body
/html


I'm trying to pass a variable from a form text box into a php file
(Tony1.php).

Then, I'd like to click on a link in the Tony1.php page and get the
Tony2.php page to load with the original variable -$lname - printed on the
next page (Tony2.php).

The Tony2.php loads when I click the link but the value from the variable is
not printed.

Any help would be greatly appreciated.
The code is below.
Tony Ritter
...


file://TonyForm.html//

HTML
FORM ACTION=Tony1.php  METHOD=get
Name: INPUT TYPE=text NAME=lname br
INPUT TYPE=Submit  VALUE=Go
/FORM
/HTML

.
file://Tony1.php//

?
echo (Welcome $lname);
?
A HREF=Tony2.php?name=?echo($lname) ? Link /A


...
file://Tony2.php//

Hello


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Trying to pass a variable through a form...

2001-12-06 Thread Anthony Ritter

I'm trying to pass a variable from a form text box into a php file
(Tony1.php).

Then, I'd like to click on a link in the Tony1.php page and get the
Tony2.php page to load with the original variable -$lname - printed on the
next page (Tony2.php).

The Tony2.php loads when I click the link but the value from the variable is
not printed.

Any help would be greatly appreciated.
The code is below.
Tony Ritter
...


file://TonyForm.html//

HTML
FORM ACTION=Tony1.php  METHOD=get
Name: INPUT TYPE=text NAME=lname br
INPUT TYPE=Submit  VALUE=Go
/FORM
/HTML

.
file://Tony1.php//

?
echo (Welcome $lname);
?
A HREF=Tony2.php?name=?echo($lname) ? Link /A


...
file://Tony2.php//

Hello





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Trying to pass a variable through a form...

2001-12-06 Thread Alex Shi

Can you paste Tnoy2.php script? Please make sure in Tony2.php $name
is printed but not $lname.

Alex

- Original Message -
From: Anthony Ritter [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 07, 2001 12:01 AM
Subject: [PHP] Trying to pass a variable through a form...


 I'm trying to pass a variable from a form text box into a php file
 (Tony1.php).

 Then, I'd like to click on a link in the Tony1.php page and get the
 Tony2.php page to load with the original variable -$lname - printed on the
 next page (Tony2.php).

 The Tony2.php loads when I click the link but the value from the variable
is
 not printed.

 Any help would be greatly appreciated.
 The code is below.
 Tony Ritter
 ...


 file://TonyForm.html//

 HTML
 FORM ACTION=Tony1.php  METHOD=get
 Name: INPUT TYPE=text NAME=lname br
 INPUT TYPE=Submit  VALUE=Go
 /FORM
 /HTML

 .
 file://Tony1.php//

 ?
 echo (Welcome $lname);
 ?
 A HREF=Tony2.php?name=?echo($lname) ? Link /A


 ...
 file://Tony2.php//

 Hello





 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Trying to pass a variable through a form...

2001-12-06 Thread Anthony Ritter

Thanks Alex.

I typed in:
$name

within the script for Tony2.php

and it was fine.

*However*, I thought I could have the value from that variable entered into
the Tony2.php page by using the AHREF tag...

This is what I'm reading:

Let's say you wanted to construct your site so that it showed the visitors
name at the top of *every* page.   With our custom welcome message example
above, we're halfway there already.   Here are the problems we'll need to
overcome to extend the example into what we need.

We need the name on *every* page of the site, not just one.

The first problem isn't too hard too overcome.  Once we have the user's name
in a variable on one page, we can pass it with any request to another page
by adding the name to the query string of all links:

A HREF=Tony2.php?name=?php echo($lname); ? Link /A

I thought that by having the php script within the AHREF tag that would
accomplish that without coding each page with:

echo $name


Please advise if and when you get a chance...
TR
..

Alex Shi [EMAIL PROTECTED] wrote in message
018101c17ed4$c0a8a990$0105050a@pony">news:018101c17ed4$c0a8a990$0105050a@pony...
 Can you paste Tnoy2.php script? Please make sure in Tony2.php $name
 is printed but not $lname.

 Alex



 - Original Message -
 From: Anthony Ritter [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, December 07, 2001 12:01 AM
 Subject: [PHP] Trying to pass a variable through a form...


  I'm trying to pass a variable from a form text box into a php file
  (Tony1.php).
 
  Then, I'd like to click on a link in the Tony1.php page and get the
  Tony2.php page to load with the original variable -$lname - printed on
the
  next page (Tony2.php).
 
  The Tony2.php loads when I click the link but the value from the
variable
 is
  not printed.
 
  Any help would be greatly appreciated.
  The code is below.
  Tony Ritter
  ...
 
 
  file://TonyForm.html//
 
  HTML
  FORM ACTION=Tony1.php  METHOD=get
  Name: INPUT TYPE=text NAME=lname br
  INPUT TYPE=Submit  VALUE=Go
  /FORM
  /HTML
 
  .
  file://Tony1.php//
 
  ?
  echo (Welcome $lname);
  ?
  A HREF=Tony2.php?name=?echo($lname) ? Link /A
 
 
  ...
  file://Tony2.php//
 
  Hello




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]