Jump to content

Recommended Posts

Hi All,

 

Basically I'm trying to create about 10 different forms that will all be sent into an email and at the option at the end you are able to purchase a website via paypal.

 

The Forms i'll be using are:

  • Company Name
  • Your E-Mail
  • Company Address
  • Company Postcode
  • Current Website
  • New Web Address
  • Company E-Mail Address
  • Number of Pages Required
  • Number of Images Required
  • Number of Colours Required

 

There will also be an option to add an attachment that will be attached onto the e-mail.

 

At the bottom of the page there will be button called submit, when you press submit you will be able to purchase what you want for £99 via paypal.

 

This is the coding i've done and its wrong.

 


if($Submit=="Send")
{
$msg1="";
if($name=="")
{
	$msg1.="Company Name<br>";
}
if($email=="")
{
	$msg1.="Your E-mail<br>";
}
if($address=="")
{
	$msg1.="Company Address<br>";
}
if($postcode=="")
{
	$msg1.="Company Postcode<br>";
}
if($currentwebaddress=="")
{
	$msg1.="Current Web Address<br>";
}
if($newwebaddress=="")
{
	$msg1.="New Web Address<br>";
}
if($nemail=="")
{
	$msg1.="Email Address<br>";
}
if($nopr=="")
{
	$msg1.="Number Of Pages Required<br>";
}
if($noir=="")
{
	$msg1.="Number Of Images Required<br>";
}
if($nocr=="")
{
	$msg1.="Number Of Colours Required<br>";
}
else
{
	if(substr_count($email,"@")==0)
	{
		$msg1.="Enter proper email ID. Eg : yourname@codefarm.co.uk<br>";
	}
}
if($comments=="")
{
	$msg1.="Enter Comments<br>";
}

if($msg1=="")
{
    $body="Company Name: $name\r\n";
    	$body.="Your Email: $email\r\n";
    	$body.="Company Address: $address\r\n";
    	$body.="Company Postcode: $postcode\r\n";
	$body.="Current Website: $currentwebaddress\r\n";
    	$body.="New Web Address: $newwebaddress\r\n";
    	$body.="Email Address: $nemail\r\n";
    	$body.="Number Of Pages Required: $nopr\r\n";
    	$body.="Number Of Images Required: $noir\r\n";
    	$body.="Number Of Colours Requires: $nocr\r\n";
      	
    	$body.="How can we help you (enter your comments): $comments\r\n";
	//echo $body;
    	//mail("testing@keyclicks.co.uk","Enquiry",$body,"From: $email\r\n");
	mail("info@cdefarm.co.uk","Enquiry",$body,"From: $email\r\n");

}
}
?>
<script language="javascript1.2" type="text/javascript">
  function check()
  {
  
  var msg=""
  if(document.contactform.email.value=="")
  {
 msg+="Enter Email ID\n";
  }
   if((document.contactform.email.value!="") && (document.contactform.email.value.indexOf("@")==-1 || document.contactform.email.value.indexOf(".")==-1))
     {
 msg="Enter proper email ID. Eg : yourname@codefarm.co.uk\n";
 }
 if(document.contactform.name.value=="")
 {
 msg+="Enter Company Name\n";
 }
 if(document.contactform.email.value=="")
 {
 msg+="Enter Your E-mail\n";
 }
 if(document.contactform.address.value=="")
 {
 msg+="Enter Your Company Address\n";
 }
 if(document.contactform.postcode.value=="")
 {
 msg+="Enter Postcode\n";
 }
 if(document.contactform.currentwebsite.value=="")
 {
 msg+="Enter Current Website\n";
 }
 if(document.contactform.newwebaddress.value=="")
 {
 msg+="Enter New Web Address\n";
 }
 if(document.contactform.nemail.value=="")
 {
 msg+="Enter New E-Mail\n";
 }
 if(document.contactform.nopr.value=="")
 {
 msg+="Enter Number Of Pages Required\n";
 }
 if(document.contactform.noir.value=="")
 {
 msg+="Enter Number Of Images Required\n";
 }
 if(document.contactform.nocr.value=="")
 {
 msg+="Enter Number Of Colour Required\n";
 }

 if(msg!="")
 {
 	alert(msg);
	return false;
 }
 return true
  
  }
</script>
<div class="mainbody">
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="Apparel Analyst">
<tr>
    <td class="pad6"><span class="head1">Contact Us</span><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br />
<form name="contactform" action="contact.php" method="post" onsubmit="return check()">
<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="Apparel Analyst"><tr><td colspan="2">
<? if(($Submit!="Send") or ($msg1!="")){?>

<?
if(isset($msg1))
{
echo "<tr><td colspan=\"2\"><font color=\"red\"><b>".$msg1."<br></b></font></td></tr>";
}
?>
<tr valign="top"><td align="right"><img src="images/spacer.gif" width="100" height="1" alt="" /><br />Company Name: *  </td><td width="100%"> <input type="text" size="30" name="name" value="<?echo $name;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

  <tr valign="top"><td align="right">Your Email: *  </td><td> <input type="text" size="30" name="email" value="<?echo $email;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

   <tr valign="top"><td align="right">Company Address: *  </td><td> <input type="text" size="30" name="address" value="<?echo $address;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

    <tr valign="top"><td align="right">Company Postcode: *  </td><td> <input type="text" size="30" name="postcode" value="<?echo $postcode;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

<tr valign="top"><td align="right"><img src="images/spacer.gif" width="100" height="1" alt="" /><br />Current Website: *  </td><td width="100%"> <input type="text" size="30" name="currentwebsite" value="<?echo $currentwebsite;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

<p><u>Website Details</u></p>

  <tr valign="top"><td align="right">New Web Address *  </td><td> <input type="text" size="30" name="newwebaddress" value="<?echo $newwebaddress;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

   <tr valign="top"><td align="right">New Email Address: *  </td><td> <input type="text" size="30" name="newemailaddress" value="<?echo $nemail;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

   <tr valign="top"><td align="right">Number of Pages Required: *  </td><td> <input type="text" size="30" name="nopr" value="<?echo $nopr;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

<tr valign="top"><td align="right"><img src="images/spacer.gif" width="100" height="1" alt="" /><br /> Number of Images Required *  </td><td width="100%"> <input type="text" size="30" name="noir" value="<?echo $noir;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>

  <tr valign="top"><td align="right"> Number of Colours Required *  </td><td> <input type="text" size="30" name="nocr" value="<?echo $nocr;?>"><br /><img src="images/spacer.gif" width="1" height="10" alt="" /><br /></td></tr>
  
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="Submit" />
</form>


<!--<tr valign="top"><td>May we email you with news of interest to you in the future? *</td><td>   <INPUT TYPE=RADIO NAME="subscription_cost" id="subscription_cost" VALUE="Auto Covers" CHECKED>   <INPUT TYPE=RADIO NAME="subscription" id="subscription" VALUE="Auto Covers" CHECKED></td></tr> -->
  <tr><td> </td><td> <input type="Submit" class="sign" name="Submit" id="Submit" value="Send" Text="Send">   <!-- <input type="Reset" class="sign" name="Reset" id="Reset" value="Reset"> --></td></tr>
<tr><td colspan="2"><br /><img src="images/spacer.gif" width="1" height="10" alt="" />

 

Kind Regards,

Chris

Link to comment
https://forums.phpfreaks.com/topic/69323-forms/
Share on other sites

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.