Jump to content


Photo

Storing data with echo?


  • Please log in to reply
4 replies to this topic

#1 mburt

mburt
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 August 2006 - 12:56 PM

Hi. I want to make a basic page where a form puts data into a page and it stays there. Like a comment box.

Here's my html:
<html>
<head>
</head>
<body>
<form action="submit.php" method="post">
 <p>Your name: <input type="text" name="name" /></p>
 <p>Your age: <input type="text" name="comment" /></p>
 <p><input type="submit" /></p>
</form>
</body>
</html>

and the PHP

<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
<b><?php echo $_POST['name']; ?></b>
<hr>
<?php echo $_POST['comment']; ?>
<hr>
 </body>
</html>

So my question is: How can I store data onto that page?

#2 123qwertyuiop456

123qwertyuiop456
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 August 2006 - 01:09 PM

Excuses, but I don't understand the question. You want to store data on the compiled apge, that is shown to user, and than to get it back? If "yes", than use hidden forms, like this:

<form action="your.php" method="post">
<input type="hidden" name="data" value="datadatadatadatadatadatadatadata">
<input type="submit" value="send">
</form>


#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 28 August 2006 - 01:11 PM

If you want the changes visible to subsequent visitors to that page, the data needs to be saved in a database on your server - in a text file or MySQL database.
Legend has it that reading the manual never killed anyone.
My site

#4 mburt

mburt
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 August 2006 - 01:29 PM

Ah. I see. So... How exactly do I do this?

Note:
I do have a MySql Database.

#5 mburt

mburt
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 August 2006 - 01:51 PM

Any help?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users