Registration form

How to save Form details

Page 1 of 1

7 Replies - 15558 Views - Last Post: 03 May 2010 - 04:17 AM

#1 Tara200  Icon User is offline

  • D.I.C Head

Reputation: -10
  • View blog
  • Posts: 85
  • Joined: 13-October 07

Registration form

Posted 02 May 2010 - 03:47 AM

Hello,
I am building a website which requires the user to register their details and then proceed to login from there,eg; when the registration form is submitted the user is then presented with the login form. When that is submitted it then takes the user to an exam page. I have the registration form below and have built the other forms, im just not sure as to how to do the linking of each form?

Eg:Register > Login > Exam.- the user is not allowed to login without having registered first.

I am not sure as to how to save the Registration form details so that they are retrievable again on the users next visit whereas they can just login to take the exam? This is the last pieces of an assignment that i have to hand in tomorrow so i would be enormously grateful of any help?

Thankyou



   
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"</script>
</head>

<form id="form2" name="form2" method="post" action=""> 
</form>

<form id="form1" name="form1" method="post" action="">
<p><span id="sprytextfield1">
<label for="Name">Name</label>
<input type="text" name="Name" id="Name" />
<span class="textfieldRequiredMsg">A value is required.</span></span></p>
<p><span id="sprytextfield2">
<label for="Address">Address</label>
<input type="text" name="Address" id="Address" />
<span class="textfieldRequiredMsg">A value is required.</span></span></p>
<p><span id="sprypassword1">
<label>Password:
<input type="password" name="Password" id="Password" />
</label>

<span class="passwordRequiredMsg">A value is required.</span><span class="passwordMinCharsMsg">Minimum number of characters not met.</span><span class="passwordMaxCharsMsg">Exceeded maximum number of characters.</span><span class="passwordInvalidStrengthMsg">The password doesn't meet the specified strength.</span></span>

<input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0" /> Male</label>
<input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1" />
Female</label>
<input type="submit" name="Submit" id="Submit" value="Submit" />

<script type="text/javascript">
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1"{minChars:6,maxChars:8, minAlphaChars:4, maxAlphaChars:8});
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
</script>
</body>
</html>



This post has been edited by Tara200: 02 May 2010 - 01:24 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Registration form

#2 Fratyr  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 139
  • Joined: 10-April 08

Re: Registration form

Posted 02 May 2010 - 12:42 PM

Please, clean your code and leave only necessary lines.
E.G: Form and It's content, Javascripts, PHP Parser (if you use it).
Do not include bunch of styles, we don't need it ;-)
Was This Post Helpful? 0
  • +
  • -

#3 Tara200  Icon User is offline

  • D.I.C Head

Reputation: -10
  • View blog
  • Posts: 85
  • Joined: 13-October 07

Re: Registration form

Posted 02 May 2010 - 01:31 PM

have cleaned up my code....
Was This Post Helpful? 0
  • +
  • -

#4 Fratyr  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 139
  • Joined: 10-April 08

Re: Registration form

Posted 02 May 2010 - 02:28 PM

Good Coding practice: not to use capital letters in input names/values/id.

Do you plan to use PHP? Even if It's Javascript forum, the best form submit parser is PHP, but If you wish to do it on a client side, then:

1) <input type="submit"... must be replaced with type="button" - BECAUSE: submit type refreshes your page and re-runs all your javascripts, so all stored variables will be lost. type button is like a dummy click button, but you can assign an event onclick to this button.

2) Use hidden type inputs to store data. onclick="callFunction();" function callFunction() will take data from inputs on form1, validate and if okay, store them in hidden inputs of form2...

3) Use document.forname.inputname.value to get input's value data or another DOM way.

4) Try to use PHP :-)

5) I can't imagine the full image of what you're trying to do... When all your form steps is over, whatcha gonna do?
You need to collect the data and store it in DB or something...?
Was This Post Helpful? 0
  • +
  • -

#5 Tara200  Icon User is offline

  • D.I.C Head

Reputation: -10
  • View blog
  • Posts: 85
  • Joined: 13-October 07

Re: Registration form

Posted 02 May 2010 - 03:17 PM

Hi,
i don't know how to use PHP and don't have time to sort out a database so....im not actually well versed in javascript really.

The intention is after a user has registered then "onclick" a login form opens which the user can then login to the site to take the exam (which is only available via login) onclick again the exam page will open.

I want save registration details so that they can be used to validate the users details on login.

Hope that is clearer. thankyou for your input so far though i shall try what you suggest,
Was This Post Helpful? 0
  • +
  • -

#6 Tara200  Icon User is offline

  • D.I.C Head

Reputation: -10
  • View blog
  • Posts: 85
  • Joined: 13-October 07

Re: Registration form

Posted 02 May 2010 - 04:00 PM

To be honest im not sure as to how to put those functions together.....ive never done this before so would appreciate an explanation of the code....as i don't know how to code it?
Was This Post Helpful? 0
  • +
  • -

#7 Guest_Matthias Dailey*


Reputation:

Re: Registration form

Posted 02 May 2010 - 06:56 PM

If this kind of assignment were due in your class, then you should have learned about PHP or some kind of server-side language in the class. Is Web Development your intended career path? If it is, then you should take it more seriously. If it isn't and you're just trying to pass, then I understand. Here is a bare-bones example of what you need to accomplish persistent data from one page to another.

PHP session variables.

Have the form submit to a php page, say, processor.php.

processor.php will take the data and save it in session variables. Here is an example:
<?php
	session_start(); // persistent $_SESSION superglobal now available
	
	if (array_key_exists('Name', $_POST)) { // checking for a form submission
		// must save the form data to php variables
		$_SESSION['name'] = $_POST['Name'];
		$_SESSION['addr'] = $_POST['Address'];
		$_SESSION['pwd'] = $_POST['Password'];
		$_SESSION['sex'] = $_POST['RadioGroup1'];
	}
	
	//
	if (array_key_exists('name', $_SESSION)) {
		$name = $_SESSION['name'];
	} else {
		$name = "";
	}
	
	// then write the data to the page as necessary
	
?>

<html>
<body>
	<form>
		<input type="text" name="Name" value="<?php echo $name; ?>" />
	</form>
</body>
</html>


I hope this helps. Adapt it to your needs.
Was This Post Helpful? 0

#8 Tara200  Icon User is offline

  • D.I.C Head

Reputation: -10
  • View blog
  • Posts: 85
  • Joined: 13-October 07

Re: Registration form

Posted 03 May 2010 - 04:17 AM

Hi, thankyou for your input, no we haven't actually learnt PHP,this is apart of an assignment for a GCSE revision website, which requires the users to login to access the mock exam page.

The tutor asked us to provide a list of registered students.......i think she may have been giving us a red herring as from what you have said it isn't possible to register students without using PHP or CGI, which we haven't learnt at all......just Javascript. I have completed the entire assignment except for Login the user in to take the exam and this registration form.

I am not sure as to where to put the PHP script, doe that go into the head of an HTML form or?

Thankyou for your help
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1