Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

passing values?? between pages

Posted on 2003-10-22
6
406 Views
Last Modified: 2013-12-03
problem:

i can't seem to be able to pass values from one page to another..
ok, i start with a HTML page with a form, then submit the info to the .php file..
the .php can't seem to read the variables?

here is the .html code
please advise..

is there some config i didn't do to the server?

--form.html

<HTML>
<head>
<title>form.html</title>
<META NAME="Generator" CONTENT="EditPlus">
</head>
<body>
<form action = "form.php" method = "get">
<table align = "center" border = 1 >
<tr>

<TD><font size=5><b>name</b></font></TD>
<TD><input type="text" name="name" size ="20"></TD>
</tr>
<tr>

<TD><font size=5><b>phone number</b></font></TD>
<TD><input type="text" name="phone" size="20"></TD>
</tr>
<tr>

<TD width="134" height="38" align="center">
<input type="submit" value="Yes" name="Yes"></TD>
<TD width="190" height="38" align="center">
<input type="Reset" value="Reset" name="reset"></TD>
</tr>
</table>
</form>
</body>
</HTML>

here is the .php code

--form.php

<?php
echo"<table align=center>";
echo"<TR><TD><font size=5>name</font></TD>";
echo"<TD><font size=5>$name</font></TD>";
echo"<TR><TD><font size=5>phone number</font></TD>";
echo"<TD><font size=5>$phone</font></TD>";
echo"</table>";
?>


--It is now proved beyond doubt that smoking is one of the leading causes of statistics.
0
Comment
Question by:systemx
6 Comments
 
LVL 6

Accepted Solution

by:
DoppyNL earned 90 total points
ID: 9597447
you have to use:
$_GET['name']
$_GET['phone']
and you're fine :)
Do pull them out of the string though, like this:

--form.php

<?php
echo"<table align=center>";
echo"<TR><TD><font size=5>name</font></TD>";
echo"<TD><font size=5>" . $_GET['name'] . "</font></TD>";
echo"<TR><TD><font size=5>phone number</font></TD>";
echo"<TD><font size=5>" . $_GET['phone'] . "</font></TD>";
echo"</table>";
?>
0
 

Author Comment

by:systemx
ID: 9597525
ahh .. it works!
but why do i have to use $GET?
in the text book, they don't use get?

thanks anyways?
 :D
0
 
LVL 6

Expert Comment

by:DoppyNL
ID: 9597552
old book?

depends on server configuration if you can do without $_GET or not.
with allways works, so you're better of using $_GET['name'] all the time (then it will work on all servers).
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Expert Comment

by:pmonk
ID: 9597575
systemx,

It depends on which version of PHP you're using.

Anything past about 4.1.0 you'll need to use $_GET, $_POST, etc.
Your manual may have been written for an older version...?

Peter.
0
 
LVL 1

Expert Comment

by:AgelmarJagad
ID: 9602451
You have to use get if you have global variables turned off in your php.ini file.  It is off by default, which is good because it can lead to security problems.  Stick with $_GET
0
 

Author Comment

by:systemx
ID: 9612814
Ahah! thanks guys..
yeah, my book is using version 3.xxx
i have a new book now.. i will burn the other one for wasting my time!!
:D
thanks again..
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question