validation close but no cigar
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
is it possible to send information from a htm file to a php file even tho the php file actions itself?
i have 2 files.
send.htm
getstarted.php
i want to pass values from send.htm to getstarted.php without the getstartedform.php being submitted. the only thing is that when getstarted.php is filled out, it then performs the action on itself because all the database info and check are in the same file.
anyway round this at all?
i have 2 files.
send.htm
getstarted.php
i want to pass values from send.htm to getstarted.php without the getstartedform.php being submitted. the only thing is that when getstarted.php is filled out, it then performs the action on itself because all the database info and check are in the same file.
anyway round this at all?
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
July 15th, 2004, 5:37 am
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
i have this javascript validation working a few days ago. now, it is only part working. one if statement does a check on fields entered like name, email address, postcode etc. the other if statement deals with radio buttons. now the radio button script doesnt work at all. does anyone know how that can be?
Code: [ Select ]
if (mainform.contactpostcode.value=='')
{
alert('Your contact postcode is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.doyouneed[0].checked || mainform.doyouneed[1].checked || mainform.doyouneed[2].checked || mainform.doyouneed[3].checked))
{
alert('Your need is a required field. Please try again.');
event.returnValue=false;
}
{
alert('Your contact postcode is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.doyouneed[0].checked || mainform.doyouneed[1].checked || mainform.doyouneed[2].checked || mainform.doyouneed[3].checked))
{
alert('Your need is a required field. Please try again.');
event.returnValue=false;
}
- if (mainform.contactpostcode.value=='')
- {
- alert('Your contact postcode is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.doyouneed[0].checked || mainform.doyouneed[1].checked || mainform.doyouneed[2].checked || mainform.doyouneed[3].checked))
- {
- alert('Your need is a required field. Please try again.');
- event.returnValue=false;
- }
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
this is the whole javascript code
now it doesnt work at all. well the radio button code doesnt work at all
can someone test it and let me know what is going on?
Code: [ Select ]
<SCRIPT>
function validate() {
if (mainform.name.value=='')
{
alert('Your name is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.email.value=='')
{
alert('Your email is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.contactaddress.value=='')
{
alert('Your contact address is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.workhometel.value=='')
{
alert('Your work / home telephone number is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.contactpostcode.value=='')
{
alert('Your contact postcode is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.doyouneed[0].checked || mainform.doyouneed[1].checked || mainform.doyouneed[2].checked || mainform.doyouneed[3].checked))
{
alert('Your need is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.designstyle[0].checked || mainform.designstyle[1].checked || mainform.designstyle[2].checked || mainform.designstyle[3].checked))
{
alert('Your design style is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.project[0].checked || mainform.project[1].checked || mainform.project[2].checked || mainform.project[3].checked))
{
alert('Your project is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.uses[0].checked || mainform.uses[1].checked || mainform.uses[2].checked || mainform.uses[3].checked))
{
alert('Your uses is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.programtimecompletion[0].checked || mainform.programtimecompletion[1].checked || mainform.programtimecompletion[2].checked || mainform.programtimecompletion[3].checked))
{
alert('Your program time completion is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.budgetcost[0].checked || mainform.budgetcost[1].checked || mainform.budgetcost[2].checked || mainform.budgetcost[3].checked))
{
alert('Your budget cost is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.projectdeadline[0].checked || mainform.projectdeadline[1].checked || mainform.projectdeadline[2].checked || mainform.projectdeadline[3].checked))
{
alert('Your project deadline is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.whybuild[0].checked || mainform.whybuild[1].checked || mainform.whybuild[2].checked || mainform.whybuild[3].checked))
{
alert('Your reason to build is a required field. Please try again.');
event.returnValue=false;
}
}
</SCRIPT>
<form method="POST" name="mainform" action="getstartedform.php" onsubmit="validate();">
function validate() {
if (mainform.name.value=='')
{
alert('Your name is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.email.value=='')
{
alert('Your email is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.contactaddress.value=='')
{
alert('Your contact address is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.workhometel.value=='')
{
alert('Your work / home telephone number is a required field. Please try again.');
event.returnValue=false;
}
if (mainform.contactpostcode.value=='')
{
alert('Your contact postcode is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.doyouneed[0].checked || mainform.doyouneed[1].checked || mainform.doyouneed[2].checked || mainform.doyouneed[3].checked))
{
alert('Your need is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.designstyle[0].checked || mainform.designstyle[1].checked || mainform.designstyle[2].checked || mainform.designstyle[3].checked))
{
alert('Your design style is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.project[0].checked || mainform.project[1].checked || mainform.project[2].checked || mainform.project[3].checked))
{
alert('Your project is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.uses[0].checked || mainform.uses[1].checked || mainform.uses[2].checked || mainform.uses[3].checked))
{
alert('Your uses is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.programtimecompletion[0].checked || mainform.programtimecompletion[1].checked || mainform.programtimecompletion[2].checked || mainform.programtimecompletion[3].checked))
{
alert('Your program time completion is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.budgetcost[0].checked || mainform.budgetcost[1].checked || mainform.budgetcost[2].checked || mainform.budgetcost[3].checked))
{
alert('Your budget cost is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.projectdeadline[0].checked || mainform.projectdeadline[1].checked || mainform.projectdeadline[2].checked || mainform.projectdeadline[3].checked))
{
alert('Your project deadline is a required field. Please try again.');
event.returnValue=false;
}
if (!(mainform.whybuild[0].checked || mainform.whybuild[1].checked || mainform.whybuild[2].checked || mainform.whybuild[3].checked))
{
alert('Your reason to build is a required field. Please try again.');
event.returnValue=false;
}
}
</SCRIPT>
<form method="POST" name="mainform" action="getstartedform.php" onsubmit="validate();">
- <SCRIPT>
- function validate() {
- if (mainform.name.value=='')
- {
- alert('Your name is a required field. Please try again.');
- event.returnValue=false;
- }
- if (mainform.email.value=='')
- {
- alert('Your email is a required field. Please try again.');
- event.returnValue=false;
- }
- if (mainform.contactaddress.value=='')
- {
- alert('Your contact address is a required field. Please try again.');
- event.returnValue=false;
- }
- if (mainform.workhometel.value=='')
- {
- alert('Your work / home telephone number is a required field. Please try again.');
- event.returnValue=false;
- }
- if (mainform.contactpostcode.value=='')
- {
- alert('Your contact postcode is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.doyouneed[0].checked || mainform.doyouneed[1].checked || mainform.doyouneed[2].checked || mainform.doyouneed[3].checked))
- {
- alert('Your need is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.designstyle[0].checked || mainform.designstyle[1].checked || mainform.designstyle[2].checked || mainform.designstyle[3].checked))
- {
- alert('Your design style is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.project[0].checked || mainform.project[1].checked || mainform.project[2].checked || mainform.project[3].checked))
- {
- alert('Your project is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.uses[0].checked || mainform.uses[1].checked || mainform.uses[2].checked || mainform.uses[3].checked))
- {
- alert('Your uses is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.programtimecompletion[0].checked || mainform.programtimecompletion[1].checked || mainform.programtimecompletion[2].checked || mainform.programtimecompletion[3].checked))
- {
- alert('Your program time completion is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.budgetcost[0].checked || mainform.budgetcost[1].checked || mainform.budgetcost[2].checked || mainform.budgetcost[3].checked))
- {
- alert('Your budget cost is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.projectdeadline[0].checked || mainform.projectdeadline[1].checked || mainform.projectdeadline[2].checked || mainform.projectdeadline[3].checked))
- {
- alert('Your project deadline is a required field. Please try again.');
- event.returnValue=false;
- }
- if (!(mainform.whybuild[0].checked || mainform.whybuild[1].checked || mainform.whybuild[2].checked || mainform.whybuild[3].checked))
- {
- alert('Your reason to build is a required field. Please try again.');
- event.returnValue=false;
- }
- }
- </SCRIPT>
- <form method="POST" name="mainform" action="getstartedform.php" onsubmit="validate();">
now it doesnt work at all. well the radio button code doesnt work at all
can someone test it and let me know what is going on?
- Banjer
- Novice


- Joined: Jul 14, 2004
- Posts: 21
- Status: Offline
- SpooF
- ٩๏̯͡๏۶


- Joined: May 22, 2004
- Posts: 3415
- Loc: Richland, WA
- Status: Offline
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
the code is pretty self explanitory. i can see that the getstartedform performs its own action and therefore the send.htm will act in a similar way. here is the send.htm code:
now here is the coding part of the getstartedform.php
there you see that the getstartedform.php performs a check on itself then submits.
Code: [ Select ]
<body>
<form name="form1" id="form1" method="post" action="getstartedform.php">
<table width="410" border="0">
<tr>
<td width="139">name</td>
<td width="261"><input type="text" name="name" /></td>
</tr>
<tr>
<td>email</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
</form>
</body>
<form name="form1" id="form1" method="post" action="getstartedform.php">
<table width="410" border="0">
<tr>
<td width="139">name</td>
<td width="261"><input type="text" name="name" /></td>
</tr>
<tr>
<td>email</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
</form>
</body>
- <body>
- <form name="form1" id="form1" method="post" action="getstartedform.php">
- <table width="410" border="0">
- <tr>
- <td width="139">name</td>
- <td width="261"><input type="text" name="name" /></td>
- </tr>
- <tr>
- <td>email</td>
- <td><input type="text" name="email" /></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="submit" value="submit" /></td>
- </tr>
- </table>
- </form>
- </body>
now here is the coding part of the getstartedform.php
Code: [ Select ]
<?php
//extract($_REQUEST);
if ($_POST['submit'])
{
$user="";
$host="";
$password="";
$database="";
$connection=mysql_connect($host,$user,$password) or die ("could not connect to server");
$db=mysql_select_db($database,$connection);
$sql = "insert into gstrialforma(my_date, name, email, contactaddress, mobile, workhometel, contactpostcode, projectpostcode, doyouneed, designstyle, project, uses, engineer, partywall, architect, projectmanager, design, lifestyle, structural, planning, buildingregs, otherhelp, wheelchair, partialeyesight, terraced, familychildern, semidetached, aged, allergy, detached, other, otherneeds, specifyneeds, programtimecompletion, budgetcost, projectdeadline, whybuild, otherpreferences) values ('{$_POST['my_date']}','{$_POST['name']}','{$_POST['email']}','{$_POST['contactaddress']}','{$_POST['mobile']}','{$_POST['workhometel']}','{$_POST['contactpostcode']}','{$_POST['projectpostcode']}','{$_POST['doyouneed']}','{$_POST['designstyle']}','{$_POST['project']}','{$_POST['uses']}','{$_POST['engineer']}','{$_POST['partywall']}','{$_POST['architect']}','{$_POST['projectmanager']}','{$_POST['design']}','{$_POST['lifestyle']}','{$_POST['structural']}','{$_POST['planning']}','{$_POST['buildingregs']}','{$_POST['otherhelp']}','{$_POST['wheelchair']}','{$_POST['partialeyesight']}','{$_POST['terraced']}','{$_POST['familychildern']}','{$_POST['semidetached']}','{$_POST['aged']}','{$_POST['allergy']}','{$_POST['detached']}','{$_POST['other']}','{$_POST['otherneeds']}','{$_POST['specifyneeds']}','{$_POST['programtimecompletion']}','{$_POST['budgetcost']}','{$_POST['projectdeadline']}','{$_POST['whybuild']}','{$_POST['otherpreferences']}')";
$result = mysql_query($sql) or print(mysql_error());
//mail($to, $subject, $msg, $additional_headers);
mail($_POST['email'],'Building Doctors','Hello '.$_POST['name'].', thank you for your enquirey on '.$_POST['my_date'].'. We will be following up your request shortly. You have said that: Your preferred Design Style is '.$_POST['designstyle'].'. Your approximate Construction Budget is £'.$_POST['budgetcost'].'. Please review the useful links about Profesional and our Duty of care policy located at the bottom right of the site. In the meantime wait for our call. Regards, Building Doctor', "From: athompson@building-doctors.com");
echo "<table border=1 cellpadding=2 cellspacing=2 class=biggertext><tr><td>";
echo "</tr></td><tr><td><img src=images/cr_header.gif></tr></td><tr><td>";
echo 'Hello '.$_POST['name'].', thank you for your enquirey on '.$_POST['my_date'].'.<br>We will be following up your request shortly. <br><br>You have said that: <br>Your preferred Design Style is '.$_POST['designstyle'].'. <br>Your approximate Construction Budget is £'.$_POST['budgetcost'].'.<br><br>Please review the useful links about Profesional and our Duty of care policy located at the bottom right of the site. <p>In the meantime wait for our call. <p><p>Regards, <br>Building Doctor';
echo "</tr></td></table>";
echo "<body onLoad=redirect() text=#000000 link=#00FFFF vlink=#C0C0C0>";
}
else
{
?>
<body leftmargin="0" topmargin="0">//start of the html form
<table width="400" align="center"height="246" border="0" cellpadding="0" cellspacing="0" class="biggertext">
<tr>
<td height="30" valign="top" ><form method="POST" name="mainform" action="getstartedform.php" onsubmit="validate();">
//extract($_REQUEST);
if ($_POST['submit'])
{
$user="";
$host="";
$password="";
$database="";
$connection=mysql_connect($host,$user,$password) or die ("could not connect to server");
$db=mysql_select_db($database,$connection);
$sql = "insert into gstrialforma(my_date, name, email, contactaddress, mobile, workhometel, contactpostcode, projectpostcode, doyouneed, designstyle, project, uses, engineer, partywall, architect, projectmanager, design, lifestyle, structural, planning, buildingregs, otherhelp, wheelchair, partialeyesight, terraced, familychildern, semidetached, aged, allergy, detached, other, otherneeds, specifyneeds, programtimecompletion, budgetcost, projectdeadline, whybuild, otherpreferences) values ('{$_POST['my_date']}','{$_POST['name']}','{$_POST['email']}','{$_POST['contactaddress']}','{$_POST['mobile']}','{$_POST['workhometel']}','{$_POST['contactpostcode']}','{$_POST['projectpostcode']}','{$_POST['doyouneed']}','{$_POST['designstyle']}','{$_POST['project']}','{$_POST['uses']}','{$_POST['engineer']}','{$_POST['partywall']}','{$_POST['architect']}','{$_POST['projectmanager']}','{$_POST['design']}','{$_POST['lifestyle']}','{$_POST['structural']}','{$_POST['planning']}','{$_POST['buildingregs']}','{$_POST['otherhelp']}','{$_POST['wheelchair']}','{$_POST['partialeyesight']}','{$_POST['terraced']}','{$_POST['familychildern']}','{$_POST['semidetached']}','{$_POST['aged']}','{$_POST['allergy']}','{$_POST['detached']}','{$_POST['other']}','{$_POST['otherneeds']}','{$_POST['specifyneeds']}','{$_POST['programtimecompletion']}','{$_POST['budgetcost']}','{$_POST['projectdeadline']}','{$_POST['whybuild']}','{$_POST['otherpreferences']}')";
$result = mysql_query($sql) or print(mysql_error());
//mail($to, $subject, $msg, $additional_headers);
mail($_POST['email'],'Building Doctors','Hello '.$_POST['name'].', thank you for your enquirey on '.$_POST['my_date'].'. We will be following up your request shortly. You have said that: Your preferred Design Style is '.$_POST['designstyle'].'. Your approximate Construction Budget is £'.$_POST['budgetcost'].'. Please review the useful links about Profesional and our Duty of care policy located at the bottom right of the site. In the meantime wait for our call. Regards, Building Doctor', "From: athompson@building-doctors.com");
echo "<table border=1 cellpadding=2 cellspacing=2 class=biggertext><tr><td>";
echo "</tr></td><tr><td><img src=images/cr_header.gif></tr></td><tr><td>";
echo 'Hello '.$_POST['name'].', thank you for your enquirey on '.$_POST['my_date'].'.<br>We will be following up your request shortly. <br><br>You have said that: <br>Your preferred Design Style is '.$_POST['designstyle'].'. <br>Your approximate Construction Budget is £'.$_POST['budgetcost'].'.<br><br>Please review the useful links about Profesional and our Duty of care policy located at the bottom right of the site. <p>In the meantime wait for our call. <p><p>Regards, <br>Building Doctor';
echo "</tr></td></table>";
echo "<body onLoad=redirect() text=#000000 link=#00FFFF vlink=#C0C0C0>";
}
else
{
?>
<body leftmargin="0" topmargin="0">//start of the html form
<table width="400" align="center"height="246" border="0" cellpadding="0" cellspacing="0" class="biggertext">
<tr>
<td height="30" valign="top" ><form method="POST" name="mainform" action="getstartedform.php" onsubmit="validate();">
- <?php
- //extract($_REQUEST);
- if ($_POST['submit'])
- {
- $user="";
- $host="";
- $password="";
- $database="";
- $connection=mysql_connect($host,$user,$password) or die ("could not connect to server");
- $db=mysql_select_db($database,$connection);
- $sql = "insert into gstrialforma(my_date, name, email, contactaddress, mobile, workhometel, contactpostcode, projectpostcode, doyouneed, designstyle, project, uses, engineer, partywall, architect, projectmanager, design, lifestyle, structural, planning, buildingregs, otherhelp, wheelchair, partialeyesight, terraced, familychildern, semidetached, aged, allergy, detached, other, otherneeds, specifyneeds, programtimecompletion, budgetcost, projectdeadline, whybuild, otherpreferences) values ('{$_POST['my_date']}','{$_POST['name']}','{$_POST['email']}','{$_POST['contactaddress']}','{$_POST['mobile']}','{$_POST['workhometel']}','{$_POST['contactpostcode']}','{$_POST['projectpostcode']}','{$_POST['doyouneed']}','{$_POST['designstyle']}','{$_POST['project']}','{$_POST['uses']}','{$_POST['engineer']}','{$_POST['partywall']}','{$_POST['architect']}','{$_POST['projectmanager']}','{$_POST['design']}','{$_POST['lifestyle']}','{$_POST['structural']}','{$_POST['planning']}','{$_POST['buildingregs']}','{$_POST['otherhelp']}','{$_POST['wheelchair']}','{$_POST['partialeyesight']}','{$_POST['terraced']}','{$_POST['familychildern']}','{$_POST['semidetached']}','{$_POST['aged']}','{$_POST['allergy']}','{$_POST['detached']}','{$_POST['other']}','{$_POST['otherneeds']}','{$_POST['specifyneeds']}','{$_POST['programtimecompletion']}','{$_POST['budgetcost']}','{$_POST['projectdeadline']}','{$_POST['whybuild']}','{$_POST['otherpreferences']}')";
- $result = mysql_query($sql) or print(mysql_error());
- //mail($to, $subject, $msg, $additional_headers);
- mail($_POST['email'],'Building Doctors','Hello '.$_POST['name'].', thank you for your enquirey on '.$_POST['my_date'].'. We will be following up your request shortly. You have said that: Your preferred Design Style is '.$_POST['designstyle'].'. Your approximate Construction Budget is £'.$_POST['budgetcost'].'. Please review the useful links about Profesional and our Duty of care policy located at the bottom right of the site. In the meantime wait for our call. Regards, Building Doctor', "From: athompson@building-doctors.com");
- echo "<table border=1 cellpadding=2 cellspacing=2 class=biggertext><tr><td>";
- echo "</tr></td><tr><td><img src=images/cr_header.gif></tr></td><tr><td>";
- echo 'Hello '.$_POST['name'].', thank you for your enquirey on '.$_POST['my_date'].'.<br>We will be following up your request shortly. <br><br>You have said that: <br>Your preferred Design Style is '.$_POST['designstyle'].'. <br>Your approximate Construction Budget is £'.$_POST['budgetcost'].'.<br><br>Please review the useful links about Profesional and our Duty of care policy located at the bottom right of the site. <p>In the meantime wait for our call. <p><p>Regards, <br>Building Doctor';
- echo "</tr></td></table>";
- echo "<body onLoad=redirect() text=#000000 link=#00FFFF vlink=#C0C0C0>";
- }
- else
- {
- ?>
- <body leftmargin="0" topmargin="0">//start of the html form
- <table width="400" align="center"height="246" border="0" cellpadding="0" cellspacing="0" class="biggertext">
- <tr>
- <td height="30" valign="top" ><form method="POST" name="mainform" action="getstartedform.php" onsubmit="validate();">
there you see that the getstartedform.php performs a check on itself then submits.
- SpooF
- ٩๏̯͡๏۶


- Joined: May 22, 2004
- Posts: 3415
- Loc: Richland, WA
- Status: Offline
- Cafu
- Student


- Joined: Jul 15, 2004
- Posts: 97
- Status: Offline
That code worked for me in IE.
Is it getting through the whole function? I was thinking that maybe if you are referencing an invalid form object the function could be dying before it reaches the radio button validation.
For example, if "workhometel" is mispelled or doesn't exist in the form, you may not be getting to the radio button validation.
Also, your code doesn't work for me in Netscape (v7.1). You should be referencing the form as document.mainform, not just mainform.
Is it getting through the whole function? I was thinking that maybe if you are referencing an invalid form object the function could be dying before it reaches the radio button validation.
For example, if "workhometel" is mispelled or doesn't exist in the form, you may not be getting to the radio button validation.
Also, your code doesn't work for me in Netscape (v7.1). You should be referencing the form as document.mainform, not just mainform.
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
- Nem
- Guru


- Joined: Feb 13, 2004
- Posts: 1243
- Loc: UK
- Status: Offline
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
send.htm is a form that sends the info to the getstartedform.php
send.htm isnt a php file so i cannot have $_post['my_date'] at all. what i want to do is send the info that is filled out in the send.htm to the getstartedform.php
the action is getstartedform.php but on the actual getstartedform.php the action is also getstartedform.php so maybe it cannot be done then
send.htm isnt a php file so i cannot have $_post['my_date'] at all. what i want to do is send the info that is filled out in the send.htm to the getstartedform.php
the action is getstartedform.php but on the actual getstartedform.php the action is also getstartedform.php so maybe it cannot be done then
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
Code: [ Select ]
<script language="JavaScript" type="text/javascript">
<!--
function x(){
return;
}
function validate(){
if ((document.getstartedform.name.value=='') || (document.getstartedform.email.value=='') || (document.getstartedform.mobile.value=='')){
alert('Please check all fields again before submitting as there are some missing entries');
return false;
}
if ((document.getstartedform.doyouneed[0].checked == false ) && ( document.getstartedform.doyouneed[1].checked == false ) && ( document.getstartedform.doyouneed[2].checked == false ) && ( document.getstartedform.doyouneed[3].checked == false ))
{
alert ( "Please register your type of need" );
return false;
}
else {
return true;
}
}
//-->
</script>
<!--
function x(){
return;
}
function validate(){
if ((document.getstartedform.name.value=='') || (document.getstartedform.email.value=='') || (document.getstartedform.mobile.value=='')){
alert('Please check all fields again before submitting as there are some missing entries');
return false;
}
if ((document.getstartedform.doyouneed[0].checked == false ) && ( document.getstartedform.doyouneed[1].checked == false ) && ( document.getstartedform.doyouneed[2].checked == false ) && ( document.getstartedform.doyouneed[3].checked == false ))
{
alert ( "Please register your type of need" );
return false;
}
else {
return true;
}
}
//-->
</script>
- <script language="JavaScript" type="text/javascript">
- <!--
- function x(){
- return;
- }
- function validate(){
- if ((document.getstartedform.name.value=='') || (document.getstartedform.email.value=='') || (document.getstartedform.mobile.value=='')){
- alert('Please check all fields again before submitting as there are some missing entries');
- return false;
- }
- if ((document.getstartedform.doyouneed[0].checked == false ) && ( document.getstartedform.doyouneed[1].checked == false ) && ( document.getstartedform.doyouneed[2].checked == false ) && ( document.getstartedform.doyouneed[3].checked == false ))
- {
- alert ( "Please register your type of need" );
- return false;
- }
- else {
- return true;
- }
- }
- //-->
- </script>
part of this code works and part does not.
this part works:
Code: [ Select ]
if ((document.getstartedform.name.value=='') || (document.getstartedform.email.value=='') || (document.getstartedform.mobile.value=='')){
alert('Please check all fields again before submitting as there are some missing entries');
return false;
}
alert('Please check all fields again before submitting as there are some missing entries');
return false;
}
- if ((document.getstartedform.name.value=='') || (document.getstartedform.email.value=='') || (document.getstartedform.mobile.value=='')){
- alert('Please check all fields again before submitting as there are some missing entries');
- return false;
- }
but this part does not:
Code: [ Select ]
if ((document.getstartedform.doyouneed[0].checked == false ) && ( document.getstartedform.doyouneed[1].checked == false ) && ( document.getstartedform.doyouneed[2].checked == false ) && ( document.getstartedform.doyouneed[3].checked == false ))
{
alert ( "Please register your type of need" );
return false;
}
{
alert ( "Please register your type of need" );
return false;
}
- if ((document.getstartedform.doyouneed[0].checked == false ) && ( document.getstartedform.doyouneed[1].checked == false ) && ( document.getstartedform.doyouneed[2].checked == false ) && ( document.getstartedform.doyouneed[3].checked == false ))
- {
- alert ( "Please register your type of need" );
- return false;
- }
the top one is for a text field. the botton one is for a checkbox (i assume it can work for a radio button or checkbox) or radio button. either way it doesnt work at all. can someone adjust this so they both work?
- SpooF
- ٩๏̯͡๏۶


- Joined: May 22, 2004
- Posts: 3415
- Loc: Richland, WA
- Status: Offline
send -> getstartedform -> getstartedform
getstartedform.php submits to a database right?
so why dont you just do something like this so the form in getstartedform.php has to be filled out along with form (not sure if this works still dont get it sorry dude)
getstartedform.php submits to a database right?
so why dont you just do something like this so the form in getstartedform.php has to be filled out along with form (not sure if this works still dont get it sorry dude)
PHP Code: [ Select ]
if($getstartedform == submit && $form == submit) {
//database stuff
}
//database stuff
}
- if($getstartedform == submit && $form == submit) {
- //database stuff
- }
- s15199d
- Expert


- Joined: Feb 20, 2004
- Posts: 524
- Loc: NC, USA
- Status: Offline
Code: [ Select ]
var i=0;
form = document.getstartedform;
for (i=0;i < form.doyouneed.length; i++){
if (form.doyouneed[i].checked == false){
alert("Please register your type of need");
return false;
}
}
form = document.getstartedform;
for (i=0;i < form.doyouneed.length; i++){
if (form.doyouneed[i].checked == false){
alert("Please register your type of need");
return false;
}
}
- var i=0;
- form = document.getstartedform;
- for (i=0;i < form.doyouneed.length; i++){
- if (form.doyouneed[i].checked == false){
- alert("Please register your type of need");
- return false;
- }
- }
***this code just addresses your code that doesn't work***
first of all try this loop it should be more efficient then concatenating everything in a long if. Plus if you don't know loops you might study this...b/c in the future if you have more than 4 options to check this could save you a lot of coding & run time.
Lastly, i'm pretty tired so I can't think right now...but I'm trying to remember if arrays work for check boxes. My guess is yet. But, it could be that arrays don't work for them. I'll think about it some more...and post when my brain has woken up some!

Give a man a fish he eats for a day. Teach a man to fish he eats for a lifetime.
- buzzby365
- Proficient


- Joined: May 14, 2004
- Posts: 288
- Status: Offline
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
July 16th, 2004, 4:48 pm
1, 2
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 24 posts
- Users browsing this forum: this213 and 163 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
