FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


retain form data





zhtway
Hi,

I am very very new to web programming and I want to retain data once the form is submitted. I tried other says but no luck. Could someone point it out for me please?

Below is the code:
Code:


<?php
session_start(); // Start the session where the code will be stored.
?>

<html>

<head>
<title>Securimage Test Form</title>
</head>

<body>

<?php
if (empty($_POST)) { ?>

<form method="POST" >
<strong>Name:</Strong><br />
<input id="text" name="usname" />
Code:<br />
<input type="text" name="code" size="12" /><br /><br />

<input type="submit" value="Submit Form" />
</form>

<?php
} else { //form is posted
echo "<center>Sorry, the code you entered was invalid. <a href=\"javascript:history.go(-1)\">Go back</a> to try again.</center>";
if (isset($_POST[username])) return $_POST[username];
}
?>
</body>
</html>
Donutey
You'll probably get better answers if you post in the PHP forum:

http://www.frihost.com/forums/vf-14.html

This forum is for website page design/layout.
Related topics
Not show resubmit form data
Remember form Data HTML
Sending Form Data to E-mail
anyone know of a good php form processer script
upload form
How to build simple PHP upload form
How to achieve 2 actions on html form "submit"
POST a form in the Same page
upload file to server using html form and CGI C
File upload with PHP, Build an upload database for your site
Can someone make me a php script?
PHP: Feedback form issues.. help =P
How To : Secure Your PHP Website
SendMail Script
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Design Tips

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.