PDA

View Full Version : Form Parsing



jelly46
02-19-2013, 12:25 PM
I have managed to create this simple form, how do I parse info the user clicks on.


<form id='sampleform' method='post' action='myurl.com' >
<p>
Name: <input type='text' name='Name' />
</p>
<p>
Email: <input type='text' name='Email' />
</p>
<input type="radio" name="subject" value="maths" /> &pound;10
<input type="radio" name="subject" value="physics" /> &pound;5
<input type="radio" name="subject" value="physics" /> &pound;3
&pound;<input type='text' name='donate-amount' />
<p>
<input type='submit' name='Submit' value='Submit' />
</p>
</form>

robert70
02-19-2013, 01:43 PM
You'll need a form handler to parse the information. Do you have one currently on your website that the form action points to? (I'm presuming that myurl.com is just a placeholder and that you have something handling the form data?)

The long and short of it is that your form handler script (typically asp, php or javascript) will get the data from your form based on the names you've given to each form field / radio button. and once it's obtained the data, you need to tell it what to do with the data (email it to someone, store it in a database, store it in a cookie, etc...)

jelly46
02-19-2013, 03:08 PM
You'll need a form handler to parse the information. Do you have one currently on your website that the form action points to? (I'm presuming that myurl.com is just a placeholder and that you have something handling the form data?)

The long and short of it is that your form handler script (typically asp, php or javascript) will get the data from your form based on the names you've given to each form field / radio button. and once it's obtained the data, you need to tell it what to do with the data (email it to someone, store it in a database, store it in a cookie, etc...)

Thanks for this, this is a big help, i found some javascript handler code, it needs to be javascript (dont, ask long story). However this code did not work, can you suggest any?

traq
02-19-2013, 03:37 PM
Thanks for this, this is a big help, i found some javascript handler code, it needs to be javascript (dont, ask long story). However this code did not work, can you suggest any?

What code? We can't help you with problems you don't describe.

If you're limited to javascript, be aware that database (on your server) and email are out. Javascript has no access to such things. If that's what you're looking for, you'll need a server-side language.