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.fir st_name.value.l ength != 0) {
var expdate = new Date ();
expdate.setTime (expdate.getTim e() + (24 * 60 * 60 * 1000));
SetCookie('Firs tName', freeform.first_ name.value, expdate);
SetCookie('Last Name', freeform.last_n ame.value, expdate);
SetCookie('Addr ess', freeform.addres s.value, expdate);
SetCookie('City ', freeform.city.v alue, expdate);
SetCookie('Stat e', freeform.state. value, expdate);
SetCookie('ZipC ode', freeform.zipcod e.value, expdate);
SetCookie('Birt hMonth', freeform.birthm m.value, expdate);
SetCookie('Birt hDay', freeform.birthd d.value, expdate);
SetCookie('Birt hYear', freeform.birthy y.value, expdate);
SetCookie('Area code', freeform.areaco de.value, expdate);
SetCookie('Phon ethree', freeform.phonet hree.value, expdate);
SetCookie('Phon efour', freeform.phonef our.value, expdate);
SetCookie('Send erEmail', 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_ch eck" value="1" >
<!--After Form my submit button:-->
<input name="submitBut ton" type="image" id="submitButto n" src="images/
submitbutton.jp g"; />
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.fir st_name.value.l ength != 0) {
var expdate = new Date ();
expdate.setTime (expdate.getTim e() + (24 * 60 * 60 * 1000));
SetCookie('Firs tName', freeform.first_ name.value, expdate);
SetCookie('Last Name', freeform.last_n ame.value, expdate);
SetCookie('Addr ess', freeform.addres s.value, expdate);
SetCookie('City ', freeform.city.v alue, expdate);
SetCookie('Stat e', freeform.state. value, expdate);
SetCookie('ZipC ode', freeform.zipcod e.value, expdate);
SetCookie('Birt hMonth', freeform.birthm m.value, expdate);
SetCookie('Birt hDay', freeform.birthd d.value, expdate);
SetCookie('Birt hYear', freeform.birthy y.value, expdate);
SetCookie('Area code', freeform.areaco de.value, expdate);
SetCookie('Phon ethree', freeform.phonet hree.value, expdate);
SetCookie('Phon efour', freeform.phonef our.value, expdate);
SetCookie('Send erEmail', 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_ch eck" value="1" >
<!--After Form my submit button:-->
<input name="submitBut ton" type="image" id="submitButto n" src="images/
submitbutton.jp g"; />
Comment