Jump to content

Send php form via email and send email/update database


vikaspa

Recommended Posts

I have made following form for my client

 

I want to send this via email

 

In this form an email is sent to

a> A person who fills up the form

b> A person hwaving the web site

 

I want to

1> Send this form via email

    How can I send this form vial email (cut paste the html is OK)

    but when person filling up the form (in his / her email) how to acess the server ?

 

    I am using Linux server

    and using code in PHP for sending email

 

2> In case i need to update database

    Can i access the server and update details ?

 

Please help

 

The form is given below (at present i am not updating the database)

 

<?

$MODULE="enquirys.php";

$SITENAME="sealretailworld.com";

$SITEMAIL="[email protected], [email protected], [email protected]";

include("includes/config.inc.php");

include("includes/getsqlvaluestring.inc.php");

include("includes/class.phpmailer.php");

$FormAction = $_SERVER['PHP_SELF'];

  if (isset($_SERVER['QUERY_STRING'])) {

  $FormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

 

$showform='Y';

 

if(isset($_POST['Submit'])){

 

$showform='N';

echo $showform;

 

$subject="New enquiry has been received on $SITENAME";

$message="Enquiry  received on $SITENAME <br><br>

The details are given below<br>

Name: ".$_POST['name']."<br>

Address: ".$_POST['address']."<br>

City: ".$_POST['city']."<br>

State: ".$_POST['state']."<br>

Zip: ".$_POST['zip']."<br>

Phone No: ".$_POST['isdt']."-".$_POST['stdt']."-".$_POST['tel']."<br>

Mobile : ".$_POST['mobile']."<br>

Email Id: ".$_POST['email']."<br>

Location Details: ".$_POST['locationdetail']."<br>

Franchisee City: ".$_POST['franchiseeforcity']."<br>

Carpet Area:      ".$_POST['carpetarea']."<br>

Experience of retail Shift: ".$_POST['experience']."<br>

";

 

$to = $SITEEMAIL;

 

        mail($to, $subject, $message, "From: $email\nReply-To: $email\nContent-Type: text/html;");

 

 

$alert="<table cellspacing='0' cellpadding='0'>

  <tr>

<td colspan='3'>Dear ".ucwords($_POST['name']).",  </td>

  </tr>

  <tr>

<td colspan='3'><br>

Thank you for visiting our site.<br>

Your enquiry has been received, one of our customer support officers will get back to you shortly. <p><br>

With Best Regards,<br>

Team - ".$SITENAME." <br>

</p>

</td>

  </tr>

</table>";

 

  $to=$email;

mail($to, $subject, $message, "From: $email\nReply-To: $email\nContent-Type: text/html;");

$subject = "You had sent following enquiry on  $SITENAME";

 

$to="[email protected], [email protected], [email protected]";

mail($to, $subject, $message, "From: $email\nReply-To: $email\nContent-Type: text/html;");

}

?>

<html>

<head>

<title>indexnew</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

 

 

<link href="ashokindustry.css" rel="stylesheet" type="text/css">

<script language="JavaScript">

<!--

 

function formCheck(formobj){

// Enter name of mandatory fields

var fieldRequired = Array("name","address","city","state","zip","tel","mobile","email","locationdetail","franchiseeforcity","carpetarea","experience");

// Enter field description to appear in the dialog box

var fieldDescription = Array("Name","Address","City","State","Zip","Tel","Mobile","email","Location","Franchisee Details","Carpet Area","Experience");

// dialog message

var alertMsg = "Please complete the following fields:\n";

 

var l_Msg = alertMsg.length;

 

for (var i = 0; i < fieldRequired.length; i++){

var obj = formobj.elements[fieldRequired];

if (obj){

switch(obj.type){

case "select-one":

if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "select-multiple":

if (obj.selectedIndex == -1){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "text":

case "textarea":

if (obj.value == "" || obj.value == null){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "password":

if (obj.value == "" || obj.value == null){

alertMsg += " - " + fieldDescription + "\n";

}

break;

default:

}

if (obj.type == undefined){

var blnchecked = false;

for (var j = 0; j < obj.length; j++){

if (obj[j].checked){

blnchecked = true;

}

}

if (!blnchecked){

alertMsg += " - " + fieldDescription + "\n";

}

}

}

}

 

if (alertMsg.length == l_Msg){

 

return true;

}else{

alert(alertMsg);

return false;

}

}

 

// -->

</script>

<link href="file:///U|/smart kids/css.css" rel="stylesheet" type="text/css">

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<!-- ImageReady Slices (indexnew.psd) -->

<table id="Table_01" width="770"  height="100%"  border="0" cellpadding="0" cellspacing="0">

<tr>

<td valign="top"> </td>

</tr>

 

<tr>

<td valign="top"><table width="92%"  height="243%" border="0" cellspacing="0" cellpadding="0">

          <tr>

            <td width="6%"> </td>

            <td width="94%" valign="top">

<?php echo $alert; if($showform=='Y'){?>

<form method="post" name="contactus" id="contactus"  onsubmit="return formCheck(this)">

                  <table width="100%"  border="0" align="center" cellpadding="2" cellspacing="2" id="formtable">

                    <tr>

                      <td colspan="3" bgcolor="#F1F1ED" id="toptable"><div align="center">

                        <p><strong>Franchisee Details Form </strong></p>

                      </div></td>

                    </tr>

                    <tr>

                      <td colspan="3" align="center" bgcolor="#F1F1ED" id="toptable"></td>

                    </tr>

                   

                    <tr id="row">

                      <td width="28%" bgcolor="#F1F1ED" class="text12bb" id="formcellinfo"><div align="left"><span class="text">Name:<span class="quicklist">*</span></span></div></td>

                      <td width="72%" colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><input name="name" type="text" class="input" id="name" value="" />                      </td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Address</td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <textarea name="address" id="address"></textarea>

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">City</td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="city" type="text" id="city">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">State</td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="state" type="text" id="state">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Zip</td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="zip" type="text" id="zip" size="15">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Tel Phone No. </td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><input name="isdt" type="text" value="" size="4"/>

-

  <input name="stdt" type="text" id="stdt" value="" size="7"/>

-

<input name="tel" type="text" value="" size="14"/></td>

                    </tr>

<tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Mobile</td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="mobile" type="text" id="mobile">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Email Id </td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="email" type="text" id="email">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Location Details </td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <textarea name="locationdetail" id="locationdetail"></textarea>

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Franchisee for which city </td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="franchiseeforcity" type="text" id="franchiseeforcity">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Carpet area (Sq. Ft.) </td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="carpetarea" type="text" id="carpetarea" size="12">

                      </label></td>

                    </tr>

                    <tr id="row">

                      <td bgcolor="#F1F1ED" class="text12bb" id="formcellinfo">Experience of Retail Shift(No.of Years). </td>

                      <td colspan="2" bgcolor="#F1F1ED" class="text12bb" id="inputcell"><label>

                        <input name="experience" type="text" id="experience" size="8">

                      </label></td>

                    </tr>

                 

                   

                    <tr id="row">

                      <td height="64" colspan="3" align="center" bgcolor="#F1F1ED" class="text12bb" id="formcellinfo"><label>

                        <input name="Submit" type="submit" id="submit" value="Submit" align="middle">

                      </label></td>

                    </tr>

                   

               

                 

                    <!--

        <tr id="row">

          <td id="formcellinfo"><span class="text">Best time to call: </span></td>

          <td colspan="2" id="inputcell"><select name="time" id="time">

            <option value="Morning" >Morning</option>

            <option value="Afternoon" selected>Afternoon</option>

            <option value="Weekend" >Weekend</option>

          </select></td>

        </tr>

-->

                   

                  </table>

                </form>

<?php } ?>

</td>

          </tr>

        </table></td>

</tr>

 

<tr>

  <td valign="bottom" height="100%"><img src="bottom.jpg" width="770" height="17"></td>

  </tr>

</table>

<!-- End ImageReady Slices -->

<map name="Map2">

<area shape="rect" coords="612,6,707,325" href="#">

</map>

 

</body>

</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.