Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
IBM developerWorks
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old November 1st, 2005, 07:53 PM
princess_leia princess_leia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 princess_leia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Modifying form validation script

Just wondering how I can modify the form and spelling validation script (by Matt Wade) so that when a user is returned to the form to edit incorrect fields the fields that were filled in correctly are not reset?
It works ok for text fields with
php Code:
Original - php Code
  1. value="<?= $string ?>" 

but not for dropdown menus and radio buttons.
Any help would be much appreciated.

Reply With Quote
  #2  
Old November 1st, 2005, 08:46 PM
princess_leia princess_leia is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 princess_leia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Modifying form validation script

Might help if I post the script:
php Code:
Original - php Code
  1.  
  2. <?php
  3. require_once ('functions.php');
  4.  
  5. $valid = TRUE;
  6.  
  7. if (isset ($_POST['submit'])) {
  8.     foreach($_POST as $key=>$value) {
  9.       $$key = $value;
  10.     }
  11.     $valid = $fn = checkLength($first_name, 1, 30);
  12.     $ln = checkLength($surname, 1, 30);
  13.     $valid = $valid && $ln;
  14.     $un = checkLength($username, 1, 30);
  15.     $valid = $valid && $un;
  16.     $us = checkUsername($username);
  17.     $valid = $valid && $us;
  18.     $em = checkEmail($email_address);
  19.     $valid = $valid && $em;
  20.     $el = checkDatabase($email_address);
  21.     $valid = $valid && $el;
  22.     $ps = checkPassword($pass);
  23.     $valid = $valid && $ps;
  24.     $ps2 = $pass == $pass2;
  25.     $valid = $valid && $ps2;
  26.     $an = checkLength($acc_name, 1, 200);
  27.     $valid = $valid && $an;
  28.     $ad = checkLength($acc_address1, 1, 30);
  29.     $valid = $valid && $ad;
  30.     $pc = checkLength($postal_code, 1, 10);
  31.     $valid = $valid && $pc;
  32.     $ct = checkLength($city, 1, 30);
  33.     $valid = $valid && $ct;
  34.     $co = checkDropdown($country, 1, 30);
  35.     $valid = $valid && $co;
  36.     $tl = checkLength($tel, 1, 30);
  37.     $valid = $valid && $tl;
  38.     if ($valid) {
  39.         include('register_acc2.php');
  40.         exit;
  41.     }
  42. } else {
  43.     $fn = $ln = $un = $us = $em = $el = $ps = $ps2 = $an = $ad = $pc = $ct = $co = $tl = TRUE;
  44.     $first_name = $surname = $username = $email_address = $acc_name = $acc_address1 = $postal_code = $city = $tel = '';
  45. }
  46. ?>


Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Modifying form validation script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway