B
bonus
Im new at Javascripting and jumped in the ocean and Im a little lost,
I am trying to get a form to do 2 things:
1) write a cookie (actually several cookies)
2) submit the information to a php file
If the site is coded for one of the commands (either one) the command
follows the submit. I have tried various ways to recode the form but
for some reason I can't make both happen on submit; depending on which
variable is first I either get a nice cookie or php return
confirmation.
The goal is to utilize the cookie on a second form to personalize the
page and to offer verification; I am open to losing the php on the
first form and sending all the information from both forms to a 3rd
page verification form with the cookie, but that is a totally
different problem.
Any suggestions?
<form name="freeform" onSubmit="
if(freeform.first_name.value.length != 0) {
var expdate = new Date ();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000));
SetCookie('FirstName', freeform.first_name.value, expdate);
SetCookie('LastName', freeform.last_name.value, expdate);
SetCookie('Address', freeform.address.value, expdate);
SetCookie('City', freeform.city.value, expdate);
SetCookie('State', freeform.state.value, expdate);
SetCookie('ZipCode', freeform.zipcode.value, expdate);
SetCookie('BirthMonth', freeform.birthmm.value, expdate);
SetCookie('BirthDay', freeform.birthdd.value, expdate);
SetCookie('BirthYear', freeform.birthyy.value, expdate);
SetCookie('Areacode', freeform.areacode.value, expdate);
SetCookie('Phonethree', freeform.phonethree.value, expdate);
SetCookie('Phonefour', freeform.phonefour.value, expdate);
SetCookie('SenderEmail', freeform.sender_email.value,
expdate);
return false;
} else {
alert('Please fill in all the form fields.');
return false;
}">
<form method="post" action="process.php">
<input type="hidden" name="submit_check" value="1" >
<!--After Form my submit button:-->
<input name="submitButton" type="image" id="submitButton" src="images/
submitbutton.jpg"; />
I am trying to get a form to do 2 things:
1) write a cookie (actually several cookies)
2) submit the information to a php file
If the site is coded for one of the commands (either one) the command
follows the submit. I have tried various ways to recode the form but
for some reason I can't make both happen on submit; depending on which
variable is first I either get a nice cookie or php return
confirmation.
The goal is to utilize the cookie on a second form to personalize the
page and to offer verification; I am open to losing the php on the
first form and sending all the information from both forms to a 3rd
page verification form with the cookie, but that is a totally
different problem.
Any suggestions?
<form name="freeform" onSubmit="
if(freeform.first_name.value.length != 0) {
var expdate = new Date ();
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000));
SetCookie('FirstName', freeform.first_name.value, expdate);
SetCookie('LastName', freeform.last_name.value, expdate);
SetCookie('Address', freeform.address.value, expdate);
SetCookie('City', freeform.city.value, expdate);
SetCookie('State', freeform.state.value, expdate);
SetCookie('ZipCode', freeform.zipcode.value, expdate);
SetCookie('BirthMonth', freeform.birthmm.value, expdate);
SetCookie('BirthDay', freeform.birthdd.value, expdate);
SetCookie('BirthYear', freeform.birthyy.value, expdate);
SetCookie('Areacode', freeform.areacode.value, expdate);
SetCookie('Phonethree', freeform.phonethree.value, expdate);
SetCookie('Phonefour', freeform.phonefour.value, expdate);
SetCookie('SenderEmail', freeform.sender_email.value,
expdate);
return false;
} else {
alert('Please fill in all the form fields.');
return false;
}">
<form method="post" action="process.php">
<input type="hidden" name="submit_check" value="1" >
<!--After Form my submit button:-->
<input name="submitButton" type="image" id="submitButton" src="images/
submitbutton.jpg"; />