Jump to content

Help on getting my php contact form to work


lhussein99

Recommended Posts

Hi,

I have very limited knowledge of PHP and I am taking migrating to a new domain services. There are 2 files. The content.php file is the main contact form and it calls contact_lcs.php which is the form submission. When I fill out the contact form and submit it, I get the error message 'web page can not be found. Listed below is the contents of contact.php and contact_lcs.php. Any help will be greatly appreciated.

 

Contents of contact.php

 

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=utf-8" />

<title>Additional Info</title>

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

<script type="text/javascript">

<!--

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

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[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

  if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

<style type="text/css">

<!--

body {

background-image: url(../bg02.jpg);

}

.style1 { color: #333333;

font-size: 10;

font-weight: bold;

}

.style2 { color: #B46004;

font-weight: bold;

}

-->

</style>

</head>

 

<body onload="MM_preloadImages('images/menu01_o.jpg','images/menu02.jpg','images/menu03_o.jpg','images/menu04_o.jpg','images/menu05_o.jpg')">

<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td><table width="800" height="266" border="0" cellpadding="0" cellspacing="0" bgcolor="#999999" class="main_table_borders">

      <tr>

        <td height="59" valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0">

            <tr>

            <td><div class="border_bottom"><a href="index.php"><img src="images/top04.jpg" alt="Stop Smoking Laser Program" width="798" height="60" border="0" /></a></div></td>

            </tr>

        </table></td>

      </tr>

      <tr>

        <td valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td width="242"><div class="border_bottom"><img src="images/top05.jpg" width="242" height="71" /></div></td>

              <td width="422" bgcolor="#2D2D2D" class="border_bottom"><div align="center" class="date">

                  <div align="left">

<!--This is a comment. Comments are not displayed in the browser

                    <?php

$date = date("l F j, Y");

echo "<b>".$date."</b>";

?>-->

                    <br />

                      </div>

              </div></td>

              <td width="136"><div class="border_bottom"><img src="images/top06.jpg" width="210" height="71" border="0" usemap="#Map" /></div></td>

            </tr>

        </table>

          <table width="800" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td width="237"><table width="243" border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td><div class="border_bottom_right"><a href="stopsmoking.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('one','','images/menu01_o.jpg',1)"><img src="images/menu01.jpg" name="one" width="242" height="38" border="0" id="one" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="nicotine.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('two','','images/menu02_o.jpg',1)"><img src="images/menu02.jpg" name="two" width="242" height="37" border="0" id="two" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="longterm.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('three','','images/menu03_o.jpg',1)"><img src="images/menu03.jpg" name="three" width="242" height="37" border="0" id="three" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="addinfo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('four','','images/menu04_o.jpg',1)"><img src="images/menu04.jpg" name="four" width="242" height="37" border="0" id="four" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('five','','images/menu05_o.jpg',1)"><img src="images/menu05.jpg" name="five" width="242" height="37" border="0" id="five" /></a></div></td>

                </tr>

              </table></td>

              <td width="563"><div class="border_bottom"><img src="images/mainpic1.jpg" width="276" height="190" /><img src="images/mainpic2.jpg" width="280" height="190" border="0" /></div></td>

            </tr>

          </table></td>

      </tr>

      <tr>

        <td valign="top"><table width="800" height="197" border="0" cellpadding="10" cellspacing="0" bgcolor="#E5E4E4">

<tr>

            <td colspan="3" valign="top"><img src="images/txt11.gif" width="389" height="35" /></td>

          </tr>

          <tr>

            <td colspan="3" valign="top"><table width="700" border="0" align="center" cellpadding="10" cellspacing="0">

              <tr>

             

                  1308 West 8th Ave.<br />

Vancouver, BC

V6H 4A6 <br />

                  Tel: 1-604-259-9888<br />

                  Fax: 1-604-675-2039<br />

                  Email: <a href="mailto:info@biothera.ca" target="_blank">info@biothera.ca<br />

                    <br />

                  </a></td>

              </tr>

              <tr>

           

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

              </tr>

              <tr>

             

            </table></td>

          </tr>

          <tr>

            <td colspan="3" valign="top"><form action="contact_lcs.php" method="post" name="" id="">

              <table width="600" border="0" align="center" cellpadding="0" cellspacing="5">

                <tr>

                  <td colspan="2" valign="top"><span class="site_text style1"> <a name="cont" id="cont"></a>Please feel free to contact us and we will get back to you.</span><span class="style1"><br />

                        <br />

                  </span></td>

                </tr>

                <tr>

                  <td width="123" valign="top" class="site_text">Name:</td>

                  <td width="551" valign="top"><span class="stylesheet1">

                    <input name="name" type="text" class="site_text" id="name2" size="40" maxlength="40" />

                  </span></td>

                </tr>

                <tr>

                  <td valign="top" class="site_text">Email:  </td>

                  <td valign="top"><span class="stylesheet1">

                    <input name="email" type="text" class="site_text" id="email2" size="40" maxlength="50" />

                  </span></td>

                </tr>

                <tr>

                  <td valign="top" class="site_text">Phone:</td>

                  <td valign="top"><span class="stylesheet1">

                    <input name="phone" type="text" class="site_text" id="email" size="30" maxlength="50" />

                  </span></td>

                </tr>

                <tr>

                  <td valign="top" class="site_text">City:</td>

                  <td valign="top"><span class="stylesheet1">

                    <input name="city" type="text" class="site_text" id="city" size="30" maxlength="50" />

                  </span></td>

                </tr>

                <tr>

                  <td height="73" valign="top" class="site_text">Comments:</td>

                  <td valign="top"><span class="stylesheet1">

                    <textarea name="msg" cols="50" rows="8" class="site_text" id="textarea"></textarea>

                  </span></td>

                </tr>

                <tr>

                  <td height="11"> </td>

                  <td valign="top"><span class="t11">

                    <input name="Send" type="submit" class="site_text" id="Send2" value="Send" />

                    <input name="Clearform" type="reset" class="site_text" id="Clearform2" value="Clear Form" />

                  </span> </td>

                </tr>

                <tr>

                  <td height="5" colspan="2" class="site_text"><strong class="red_heading"> <br />

                    </strong>

                      <p align="center"><strong>Quit Smoking Now Vancouver</strong><br />

                          <br />

                        Email: <a href="mailto:info@biothera.ca">info@biothera.ca</a></p></td>

                </tr>

              </table>

            </form></td>

          </tr>

          <tr>

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

          </tr>

        </table></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td><div class="bottom_stuff">

      <div align="right">©

        <?=date("Y");?>

        , Quit Smoking Now Vancouver. All Rights Reserved. <br />

       

        Web Design by <a href="http://www.jdmedia.ca" class="bottomlink">JD Media</a><br />

        <br />

        </div>

    </div></td>

  </tr>

</table>

 

<map name="Map" id="Map"><area shape="rect" coords="65,25,96,50" href="index.php" alt="Go Back Home" />

<area shape="rect" coords="108,24,143,50" href="sitemap.php" alt="Site Map" />

<area shape="rect" coords="153,23,187,47" href="contact.php" alt="Contact Us" />

</map>

</body>

</html>

 

Contents of contact_lcs.php

<?

include_once("mail.php");

 

$name = $_POST["name"];

$email = $_POST["email"];

$phone = $_POST["phone"];

$city = $_POST["city"];

$msg = $_POST["msg"];

 

$recipients = 'info@biothera.ca';

 

$headers["From"] = $email;

$headers["To"] = $recipients;

$headers["Subject"] = "Comments from Biothera Stop Smoking Website";

 

$headers["MIME-Version"] = "1.0";

$headers["Content-type"] = "text/html; charset=iso-8859-1";

 

$body = "<b>Name: </b>".$name."<br /><br /><b>Phone: </b>".$phone."<br /><br /><b>City: </b>".$city."<br /><br /><b>Message: </b>".stripslashes($msg);

 

$params["host"] = 'smtp.biothera.ca';

$params["port"] = "25";

$params["auth"] = true;

$params["username"] = 'donotdelete@biothera.ca';

$params["password"] = "Laser2008";

 

// Create the mail object using the Mail::factory method

$mail_object =& Mail::factory("smtp", $params);

 

$mail_object->send($recipients, $headers, $body);

 

echo ""

?>

<!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=utf-8" />

<title>Additional Info</title>

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

<script type="text/javascript">

<!--

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

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[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

  if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

//-->

</script>

<style type="text/css">

<!--

body {

background-image: url(../bg02.jpg);

}

.style1 { color: #333333;

font-size: 10;

font-weight: bold;

}

.style2 {

color: #B46004;

font-weight: bold;

}

-->

</style>

</head>

 

<body onload="MM_preloadImages('images/menu01_o.jpg','images/menu02.jpg','images/menu03_o.jpg','images/menu04_o.jpg','images/menu05_o.jpg')">

<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td><table width="800" height="266" border="0" cellpadding="0" cellspacing="0" bgcolor="#999999" class="main_table_borders">

      <tr>

        <td height="59" valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td width="244"><div class="border_bottom_right"><a href="../bodywraps/index.php"><img src="../bodywraps/images/top01.jpg" alt="InfaRed Body Wraps" width="242" height="58" border="0" /></a></div></td>

              <td><div class="border_bottom_right"><a href="../laser/index.php"><img src="../images/top02.jpg" alt="Laser Hair Therapy" width="151" height="58" border="0" /></a></div></td>

              <td><div class="border_bottom_right"><a href="../weight/index.php"><img src="../images/top03.jpg" alt="Weight Loss Laser Program" width="194" height="58" border="0" /></a></div></td>

              <td><div class="border_bottom"><a href="index.php"><img src="../images/top04.jpg" alt="Stop Smoking Laser Program" width="209" height="58" border="0" /></a></div></td>

            </tr>

        </table></td>

      </tr>

      <tr>

        <td valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td width="242"><div class="border_bottom"><img src="../images/top05.jpg" width="242" height="71" /></div></td>

              <td width="422" bgcolor="#2D2D2D" class="border_bottom"><div align="center" class="date">

                  <div align="left">

                    <?php

$date = date("l F j, Y");

echo "<b>".$date."</b>";

?>

                    <br />

                      </div>

              </div></td>

              <td width="136"><div class="border_bottom"><img src="../images/top06.jpg" width="210" height="71" border="0" usemap="#Map" /></div></td>

            </tr>

        </table>

          <table width="800" border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td width="237"><table width="243" border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td><div class="border_bottom_right"><a href="stopsmoking.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('one','','images/menu01_o.jpg',1)"><img src="images/menu01.jpg" name="one" width="242" height="38" border="0" id="one" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="nicotine.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('two','','images/menu02_o.jpg',1)"><img src="images/menu02.jpg" name="two" width="242" height="37" border="0" id="two" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="longterm.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('three','','images/menu03_o.jpg',1)"><img src="images/menu03.jpg" name="three" width="242" height="37" border="0" id="three" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="addinfo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('four','','images/menu04_o.jpg',1)"><img src="images/menu04.jpg" name="four" width="242" height="37" border="0" id="four" /></a></div></td>

                </tr>

                <tr>

                  <td><div class="border_bottom_right"><a href="contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('five','','images/menu05_o.jpg',1)"><img src="images/menu05.jpg" name="five" width="242" height="37" border="0" id="five" /></a></div></td>

                </tr>

              </table></td>

              <td width="563"><div class="border_bottom"><img src="images/mainpic1.jpg" width="276" height="190" /><img src="images/mainpic2.jpg" width="280" height="190" border="0" /></div></td>

            </tr>

          </table></td>

      </tr>

      <tr>

        <td valign="top"><table width="800" height="197" border="0" cellpadding="10" cellspacing="0" bgcolor="#E5E4E4">

<tr>

            <td colspan="3" valign="top"><img src="images/txt11.gif" width="389" height="35" /></td>

          </tr>

          <tr>

            <td colspan="3" valign="top"><table width="700" border="0" align="center" cellpadding="10" cellspacing="0">

             

              <tr>

                <td valign="top"><span class="orange_bold">Vancouver, BC</span><br />

                  1308 West 8th Ave.<br />

Vancouver, BC

V6H 4A6 <br />

                  Tel: 1-604-675-2030<br />

                  Fax: 1-604-675-2039<br />

                  Email: <a href="mailto:vancouver@biothera.ca" target="_blank">vancouver@biothera.ca<br />

                    <br />

                  </a></td>

             

            </table></td>

          </tr>

          <tr>

            <td colspan="3" valign="top">

              <table width="600" border="0" align="center" cellpadding="0" cellspacing="5">

                <tr>

                  <td width="674" valign="top"><div align="center"><span class="site_text style1"><a name="cont" id="cont"></a>Thank you

                    <? echo $name; ?>

                    , your comments have been submitted!</span><span class="style1"><br />

                      <br />

                        </span></div></td>

                </tr>

                <tr>

                  <td height="5" class="site_text"><strong class="red_heading"> <br />

                    </strong>

                      <p align="center"><strong>Biothera Laser Clinics</strong><br />

                          <br />

                        Email: <a href="mailto:quitsmokingnowvancouver.ca">quitsmokingnowvancouver.ca</a></p></td>

                </tr>

              </table>

            </td>

          </tr>

          <tr>

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

          </tr>

        </table></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td><div class="bottom_stuff">

      <div align="right">©

        <?=date("Y");?>

        , Biothera Laser Clinics. All Rights Reserved. <br />

       

        Web Design by <a href="http://www.jdmedia.ca" class="bottomlink">JD Media</a><br />

        <br />

        </div>

    </div></td>

  </tr>

</table>

 

<map name="Map" id="Map"><area shape="rect" coords="65,25,96,50" href="index.php" alt="Go Back Home" />

<area shape="rect" coords="108,24,143,50" href="sitemap.php" alt="Site Map" />

<area shape="rect" coords="153,23,187,47" href="contact.php" alt="Contact Us" />

</map>

</body>

</html>

Link to comment
Share on other sites

Here's your problem:

 

<form action="contact_lcs.php" method="post" name="" id="">

 

Change the action to "contact.php" and you'll be all set.

No.

 

Check your file name for capitalization or other typing errors.  The name used in the form obviously is contact_lcs.php so make sure the file name matches and is saved as with the php extension.

 

Unrelated to the problem but ALSO, use full php tags within your page. <?php  ?>  NOT <?  ?>

Link to comment
Share on other sites

No.

 

Check your file name for capitalization or other typing errors.  The name used in the form obviously is contact_lcs.php so make sure the file name matches and is saved as with the php extension.

 

Unrelated to the problem but ALSO, use full php tags within your page. <?php  ?>  NOT <?  ?>

 

Ah, my bad... missed the contact_lcs.php script in the original post.

 

Another suggestion: ensure that contact.php and contact_lcs.php are in the same directory.

Link to comment
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.