Forms and Arrays
Posted 19 April 2006 - 11:37 AM
I am trying to make a web page that uses a simple form that lets you input data and then passes that data in the form of a variable to a PHP file which then displays it on another page. But for some reason i just can't get it to work. Could someone please tell me what i'm doing wrong. Thanks in advance for any help and advice. Clinker
<table width="350" cellpadding="10" cellspacing="0" bgcolor="#fffacd" border="2">
<h4 align="center"><u>Roof Coverings</u></h4>
<form action="http://localhost/myf....php/names.php" method=post>
Title: .................... <input type="text" name="YourName">
My real name is:
<input type="text" name="RealName">
<input type="submit" name="submit" value="Submit">
$MyName = array('Colin' , 'David' , 'Peter' , 'Mark' , 'Simon' , 'Paul' , 'Lee');
Posted 19 April 2006 - 11:52 AM
<?php $name = $_POST['YourName']; $rname = $_POST['RealName']; echo "HI you're name is " . $name . ", your real name is: " . $rname; ?>
Posted 19 April 2006 - 01:54 PM
Posted 19 April 2006 - 02:06 PM
If you want to have the data available over several pages, or for the complete time that person is accessing the server, you might want to look into using a SESSION.
SESSIONS are kind of a big topic for one post, so you might want to look around a bit. I learned enough about them to use them for multi-page forms from different tutorials and articles on the web.
I hope this helps.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users