dropdown in php not retaining value ... - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-21-2008, 12:43 PM   #1 (permalink)
Regular User
 
Join Date: Nov 2008
Posts: 20
Default dropdown in php not retaining value ...

Hello;

I am trying to get an html dropdown box to work and it kind of does. The box works okay, but the information does not retain itself. Basically I have some code that checks some basic criteria for fields. The form calls itself so that the column next to the field displays an error message if something is wrong. If something is wrong on say the first name, the state jumps back to
"None" instead of displaying the actual value ( although it retains the value ). I could send entire code, but I think this gives the idea.


// State must be 2 characters
if(preg_match("/^[A-Z_]{2,}$/", $_POST["state"]) === 0)
$errState = '<class="errText">State can not be None';
************************************************** ********
<tr>
<td width="124" bgcolor="#FFFFFF">
<b><font size="2" face="Arial" color="#3366FF">&nbsp; State:</font></b></td>
<td width="278">&nbsp; <select size="1" name="state">
<option selected>None</option>
<option value="WA">Washington</option>
<option value="CA">California</option>
<option value="BC">British Columbia</option>
<option value="AB">Alberta</option>
</select></td>
<td>&nbsp;<?php if(isset($errState)) echo $errState; ?></td>
</tr>
************************************************** ********
//This will check if data is retained for state. Last Name has to have information for this to display !!!


// Last Name must be letters, dash and spaces only
if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["lname"]) === 0)
$errLName = '<class="errText">Last name must be from letters, dashes, spaces and must not start with dash';
else
$errStatus = $_POST["state"];
pepe_lepew1962 is offline   Reply With Quote
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:33 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting