Jump to content

Recommended Posts

My form doesnt work after i added a checkboxes input..i am using a image validation as well...

 

Its always asking for the verification which is suppose to do once, not everytime :S  Everything else on the site work fine though, its only this checkboxes thing who doesnt work, which i need as a requiremnt.

 

please follow my code...let me know what i am doing wrong..

 

Here is my index.php

<head>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='are') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'are') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>

<body>


<form action="orderform/mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','are','verif_box','','are','message','','are','Firstname','','are','Address','','are','City','','are','Postal','','are','Tel','','are','Name','','are','Quantity','','are','Card','','are','Domains','','are','Domains','','are','Domains','','are');return document.MM_returnValue">
  <p align="left"><font color="#FF0000">*</font> Required Field </p>
  <table width="700" border="1" cellspacing="3" cellpadding="0" bordercolor="#ECE9E9">
    <tr> 
      <td colspan="2" bgcolor="#F1F1F1"> 
        <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b>Client 
          information <br>
          </b></font></div>
      </td>
      <td valign="top" width="442" bgcolor="#F1F1F1"> 
        <div class="centerdiv"><b><font face="Arial, Helvetica, sans-serif">ORDER 
          SHEET<br>
          </font></b></div>
      </td>
    </tr>
    <tr> 
      <td width="86"> 
        <p><font face="Arial, Helvetica, sans-serif" size="2">Client</font></p>
      </td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Firstname" type="text" id="Firstname" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Firstname'];?>"/>
        </font></td>
      <td valign="top" width="442" bgcolor="#F1F1F1"> 
        <div class="centerdiv"><font face="Arial, Helvetica, sans-serif"><i>Condolence 
          Cards<br>
          </i></font></div>
      </td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Address<br>
        </font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Address" type="text" id="Address" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Address'];?>"/>
        </font></td>
      <td valign="top" rowspan="14" width="442"> 
        <div class="centerdiv"><img src="http://www.dupuisprinting.ca/images/photo-cardnumber.jpg" width="180" height="340"><br>
        </div>
        <div align="center"> 
          <table width="330" border="1" cellspacing="3" cellpadding="0" align="center" bordercolor="#ECE9E9">
            <tr> 
              <td colspan="2" bgcolor="#F1F1F1"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif"><b>Price 
                  list<br>
                  </b></font></div>
              </td>
            </tr>
            <tr> 
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b><i>Black 
                  & White </i></b></font></div>
              </td>
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b><i>Color</i></b></font></div>
              </td>
            </tr>
            <tr> 
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">25 
                  - $50.00</font></div>
              </td>
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">25 
                  - $80.00</font></div>
              </td>
            </tr>
            <tr> 
              <td width="205" height="21"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">50 
                  - $70.00</font></div>
              </td>
              <td width="205" height="21"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">50 
                  - $105.00</font></div>
              </td>
            </tr>
            <tr> 
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">75 
                  - $85.00</font></div>
              </td>
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">75 
                  - $125.00</font></div>
              </td>
            </tr>
            <tr> 
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">100 
                  - $95.00</font></div>
              </td>
              <td width="205"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2">100 
                  - $140.00</font></div>
              </td>
            </tr>
            <tr> 
              <td width="205" bgcolor="#F1F1F1"> 
                <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">50 
                  cent additional card<br>
                  </font></div>
              </td>
              <td width="205" bgcolor="#F1F1F1"> 
                <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">75 
                  cent additional card<br>
                  </font></div>
              </td>
            </tr>
            <tr> 
              <td colspan="2"> 
                <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b><i>Prices 
                  include laminated cards<br>
                  </i></b></font></div>
              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">City<br>
        </font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="City" type="text" id="City" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['City'];?>"/>
        </font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Postal 
        Code </font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Postal" type="text" id="Postal" style="padding:2px; border:1px solid #CCCCCC; width:60px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Postal'];?>" maxlength="7" size="7"/>
        <font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000"> 
        <br>
        ie: E1A 8A8</font></font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Tel</font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Tel" type="text" id="Tel" style="padding:2px; border:1px solid #CCCCCC; width:90px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Tel'];?>" maxlength="12" size="12"/>
        <br>
        <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FF0000"> 
        ie: 506 123 4567</font></font></td>
    </tr>
    <tr> 
      <td colspan="2" bgcolor="#F1F1F1" height="18"> 
        <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b>Information 
          on the deceast<br>
          </b></font></div>
      </td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Name<br>
        </font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Name" type="text" id="Name" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Name'];?>"/>
        </font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Quantity</font><br>
        <br>
      </td>
      <td width="152"><font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Quantity" type="text" id="Quantity" style="padding:2px; border:1px solid #CCCCCC; width:50px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Quantity'];?>"/>
        </font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Card # 
        <br>
        </font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Card" type="text" id="Card" style="padding:2px; border:1px solid #CCCCCC; width:50px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Card'];?>"/>
        <font size="1"><a href="javascript:open1()"><br>
        see the cards</a></font></font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Prayer 
        #<br>
        </font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="Prayer" type="text" id="Prayer" style="padding:2px; border:1px solid #CCCCCC; width:50px; height:19px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Prayer'];?>"/>
        <font size="1"><a href="javascript:open2()"><br>
        see the prayers</a></font></font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Text<br>
        </font></td>
      <td width="152"><font face="Arial, Helvetica, sans-serif" size="2"> 
        <input name="English" type="checkbox" id="English" style="padding:1px; border:1px solid #CCCCCC; width:15px; height:15px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['English'];?>"/>
        english <font size="1"><a href="javascript:open3()"><br>
        view sample</a></font><br>
        <input name="Francais" type="checkbox" id="Francais" style="padding:1px; border:1px solid #CCCCCC; width:15px; height:15px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['Francais'];?>"/>
        français <font size="1"><a href="javascript:open3()"><br>
        view sample</a></font></font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Photo 
        supplied<br>
        <b><font size="1" color="#FF0000">ps, if photo is scanned, please scan 
        at 400DPI</font></b></font></td>
      <td width="152"> <font face="Arial, Helvetica, sans-serif" size="2"> 
        <input type="checkbox" name="scanoriginal" value="checkbox">
        orignal<br>
        <input type="checkbox" name="scanemail" value="checkbox">
        email<br>
        <input type="checkbox" name="scancd" value="checkbox">
        cd </font></td>
    </tr>
    <tr> 
      <td width="86"><font face="Arial, Helvetica, sans-serif" size="2">Comments</font></td>
      <td width="152"><font face="Arial, Helvetica, sans-serif" size="2"> 
        <textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"><?php echo $_GET['message'];?></textarea>
        </font></td>
    </tr>
    <tr>
      <td colspan="2" height="39" bgcolor="#F1F1F1"> <font color="#FF0000">*</font> 
        <font face="Arial, Helvetica, sans-serif" size="2">Type verification image:</font><br />
    <input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:19px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/>
    <img src="orderform/verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
    <br />
        <!-- if the variable "wrong_code" is sent from previous page then display the error field -->
        <?php if(isset($_GET['wrong_code'])){?>
          
        <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;"><font face="Arial, Helvetica, sans-serif" size="2">Wrong 
          verification code</font></div>
        <br />
        <br />
  <?php ;}?>
      </td>
    </tr>
    <tr> 
      <td colspan="2" height="39" bgcolor="#F1F1F1"> 
        <div align="center"> 
          <input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Send Message"/>

        </div>
      </td>
    </tr>
  </table>
  <p> </p>
</form>

</body>
</html>

 

 

Here is my mailer.php

 

<?php


// load the variables form address bar
$subject = $_REQUEST["subject"];
$message = $_POST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];
$Firstname = $_POST["Firstname"];
$Address = $_POST["Address"];
$City = $_POST["City"];
$Postal = $_POST["Postal"];
$Tel = $_POST["Tel"];
$Name = $_POST["Name"];
$Quantity = $_POST["Quantity"];
$Card = $_POST["Card"];
$Prayer = $_POST["Prayer"];
$English = $_POST["English"];
$Francais = $_POST["Francais"];
  
// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message); 
$subject = stripslashes($subject); 
$from = stripslashes($from); 
$Firstname = stripslashes($Firstname); 
$Address = stripslashes($Address); 
$City = stripslashes($City); 
$Postal = stripslashes($Postal); 
$Tel = stripslashes($Tel); 
$Name = stripslashes($Name); 
$Quantity = stripslashes($Quantity); 
$Card = stripslashes($Card); 
$Prayer = stripslashes($Prayer); 
$English = stripslashes($English); 
$Francais = $_POST["Francais"];


// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
mail("info@idweb.ca", 'IDWEB Condolence Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$Firstname."\n\n".$Domains."\n\n".$message, "From: $from");
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style></head>

<body>
<p align="center"><img src="http://www.id.ca/images/Untitled-1.jpg" width="126" height="66"><img src="http://www.id.ca/images/Untitled-2.jpg" width="73" height="65"><br>
  <img src="http://www.idweb.ca/images/Untitled-3.jpg" width="126" height="43"><img src="http://www.id.ca/images/Untitled-4.jpg" width="73" height="43"> 
</p>
<p align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#336699">Your 
  Request Has Been Processed!<br>
  Thank you.</font></b></p>
<p align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#336699">[<a href="/">back</a>]</font></b></p>
<p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999"> 
  @ DDDD</font></p>
        </body>
</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.