Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Validation, I can't figure it out!!

Status
Not open for further replies.

51487

Technical User
Jul 8, 2003
5
US
Can anyone give me just a little bit of info on doing form validation... this is the code... I want to validate it, but also I would like to have it display a message to fill out the required field. The only one I want to validate is price. I haven't been able to figure it out at all.

Thanks!!

Spencer

<html>
<head>
<center>
<title>EB GAMES2</title>
<font size=&quot;7&quot; color=&quot;red&quot;>EB </font><font size=&quot;6&quot;>Games</font>
<hr width=&quot;50%&quot; size=&quot;7&quot; noshade color=&quot;red&quot;></center>
</head>
<body>
<p>

<center>
<font size=&quot;5&quot;><h2>Form Info</h2></font>
<br>
</center>
<blockquote><blockquote><blockquote><blockquote><blockquote><blockquote><blockquote>
<font size=&quot;5&quot;>
Title: <b><?=$_POST['title'];?></b><br><br>
Price: <b><?=$_POST['price'];?></b><br><br>
Discount: <b><?=$_POST['discount'];?></b>&nbsp&nbsp&nbsp&nbsp&nbsp
Password: <b><?=$_POST['password'];?></b><br><br>
<center></font>
<a href=&quot;eb_games.php&quot;>Back to Order Form</a>
</center>
</p>
</body>
</html>
 
What exactly do you need? If you want to determine whether the price field contains some number, you can do it directly on the page containing the form. It is late to do it here... you can use simple javascript to validate the form and then to post it to this page including the price field containing some number...
 
I just figured it out...But now I need to know how to tell it to reinput the variables that you selected for the first page.

sfogler
 
You have several choices to make those vars available:

1. Cookies
2. Hidden fields
3. Sessions

I recommend SESSIONS over all other choices listed above.
You can register variables with the session and they will be available for all pages that call session_start();

Read up on sessions in the PHP manual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top