Jump to content

Forms and Arrays


Clinker

Recommended Posts

Hello everyone. I am a PHP noob and on the verge of pulling all my hair out!
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

[u]HTML [/u]
<html>
<head>
<title>My Form</title>
</head>
<body text="#0000ff">
<div align="center">
<table width="350" cellpadding="10" cellspacing="0" bgcolor="#fffacd" border="2">
<tr><td>
<h4 align="center"><u>Roof Coverings</u></h4>

<form action="http://localhost/myfiles.php/names.php" method=post>

Title: .................... <input type="text" name="YourName">
<p>

My real name is:
<input type="text" name="RealName">
<br>
<input type="submit" name="submit" value="Submit">
</form>
</td></tr>
</table>
</div>
</body>
</html>

[u]PHP code[/u]
<?php
$MyName = array('Colin' , 'David' , 'Peter' , 'Mark' , 'Simon' , 'Paul' , 'Lee');

echo $MyName'Colin';
?>
Link to comment
Share on other sites

Greetings Clinker

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.