General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 2nd, 2003, 03:04 AM
joel558 joel558 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 joel558 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
?simple? forms question

hi,
I'm creating a registration page for my website, and am wondering how, when someone enters some information into a form, but then an error occurs(such as username already taken), and I display the error, how do I maintain the information already in placed in the form?

ie. if they enter there name, email, but enter a username that is already taken. How do I display an error, and keep their name and email already in the form?

the current version of my code is at URL
with the running version at URL

any ideas?

thanks,
joel

Reply With Quote
  #2  
Old January 2nd, 2003, 03:27 AM
wAr-AnGeL wAr-AnGeL is offline
Forum Security
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Behind You
Posts: 479 wAr-AnGeL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 50 sec
Reputation Power: 7
Send a message via ICQ to wAr-AnGeL Send a message via AIM to wAr-AnGeL
after it shows the errors make a link with the src as "javascript:history.back(-1);" that should keep the information they typed in the form.

like:
Quote:
<a href="javascript:history.back(-1);">Back to form</a>


edit: remove the space between java and script. the forum automatically inserts a space for some reason...
__________________




"Only Linux users see the end of crashes."
- Pl4t0

Last edited by wAr-AnGeL : January 2nd, 2003 at 03:30 AM.

Reply With Quote
  #3  
Old January 2nd, 2003, 03:40 AM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
You could loop through the $_POST associative array with something like this:

<?php

foreach($_POST as $k => $v)
{
echo "<input type='hidden' name='$k' value='$v'>\r\n";
}

That would output the entire form contents, such as:

<input type='hidden' name='a' value='first'>
<input type='hidden' name='b' value='second'>
<input type='hidden' name='c' value='third'>

etc... Just remember that javascript:history.go(-1) wont work on some browser, mainly some versions of IE6 that have a bug.

Reply With Quote
  #4  
Old January 2nd, 2003, 07:05 PM
joel558 joel558 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 2 joel558 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks,

i didn't think about using the $_POST variables again...
now I just use them as "value=$_POST['varName']" in each field

had to slightly change the way I did my error messaging to get it to work. Because before, submit would call the page itself when form was entered, then when an error occured, the page would be called again with "?error=#". and with the second call I lost the POST variables. so I had to redo how I dealt with errors a little bit, but no big change.

thanks,
joel

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > ?simple? forms question


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 4 hosted by Hostway
Stay green...Green IT