Page 1 of 1
PHP Contact Page
Posted: Sat Dec 06, 2003 8:40 pm
by blkshirt
I found some code on the web that I want to implement into my website, however I'm a newbie to PHP...
Here's the php code I'll post the question below...
Code: Select all
<?php
if($name) {
$name=$_GETї'name'];
$email=$_GETї'email'];
$subject1=$_GETї'subject'];
$message=$_GETї'message'];
$ip=$_SERVERї"REMOTE_ADDR"];
$host = gethostbyaddr($_SERVERї'REMOTE_ADDR']);
$host = $ip.".".$host;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if($hour<=0) { $hour+=12; }
$ts = "$hour:$min:$sec on $mon/$day/$year";
$to="you@email.com";
$subject="Moab Software Contact Form:"." $subject1";
$body="
Message from: $name
Subject: $subject1
E-mail: $email
Message: $message
Host: $host
Time: $ts";
mail($to, $subject, $body);
echo "<script>location.href="http://youhost.com/~you"</script>";
}
?>
I understand that I need to change the value in the $to but I'm confused to the final echo statement. I was only given the php file in the zip file that I downloaded...
Or does anybody know where I can find a "contact" page that basically has the following text boxes "Name, Email, Message" and a submit button? I don't need it sent to a database, just to my email address...
Thanks for the help...
blkshirt
Posted: Sat Dec 06, 2003 8:43 pm
by microthick
The final echo statement redirects the user to a page you specify after the e-mail has been sent. You might change that to a thank-you page, for example.
Posted: Sat Dec 06, 2003 8:45 pm
by blkshirt
microthick wrote:The final echo statement redirects the user to a page you specify after the e-mail has been sent. You might change that to a thank-you page, for example.
Thanks!
Posted: Sat Dec 06, 2003 9:05 pm
by blkshirt
Now I get this error when I try to go to the webpage:
http://www.blkshirt.net/contact.php
Parse error: parse error in /home/j9d2k0/public_html/contact.php on line 263
Line 263 code is:
Here's the entire code php and html code...
Code: Select all
<?php
if($name) {
$name=$_GET['name'];
$email=$_GET['email'];
$subject1=$_GET['subject'];
$message=$_GET['message'];
$ip=$_SERVER["REMOTE_ADDR"];
$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$host = $ip.".".$host;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if($hour<=0) { $hour+=12; }
$ts = "$hour:$min:$sec on $mon/$day/$year";
$to="blkshirt@earthlink.net";
$subject="blkshirt.net Contact Form:"." $subject1";
$body="
Message from: $name
Subject: $subject1
E-mail: $email
Message: $message
Host: $host
Time: $ts";
mail($to, $subject, $body);
echo "<script>location.href="http://www.blkshirt.net/thank_you.html"</script>";
}
?>
Code: Select all
<html>
<form>
<head>
<title>blkshirt.net -- Pricing</title>
<link href="css/stylesheet.css" rel="stylesheet" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#FFFFFF">
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/trans.gif" width="780" height="2"></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="javascript:void(null);" onmouseover = "window.status = 'Home';return true;" onmouseout = "window.status = '';return true;"><img src="images/home.gif" width="98" height="25" border="0"></a></td>
<td><img src="images/seperator.gif" width="3" height="25"></td>
<td><a href="javascript:void(null);" onmouseover = "window.status = 'Perry Running';return true;" onmouseout = "window.status = '';return true;"><img src="images/perry_running.gif" width="138" height="25" border="0"></a></td>
<td><img src="images/seperator.gif" width="3" height="25"></td>
<td><a href="http://www.blkshirt.net/forums/index.php" onmouseover = "window.status = 'Forums';return true;" onmouseout = "window.status = '';return true;"><img src="images/forums.gif" width="112" height="25" border="0"></a></td>
<td><img src="images/seperator.gif" width="3" height="25"></td>
<td><a href="javascript:void(null);" onmouseover = "window.status = 'myMeets';return true;" onmouseout = "window.status = '';return true;"><img src="images/mymeets.gif" width="106" height="25" border="0"></a></td>
<td><img src="images/seperator.gif" width="3" height="25"></td>
<td>
<a onmouseover="window.status = 'Pricing';return true;" onmouseout="window.status = '';return true;" href="http://www.blkshirt.net/price.html"><img src="images/pricing.gif" width="93" height="25" border="0"></a></td>
<td><img src="images/seperator.gif" width="3" height="25"></td>
<td><a href="javascript:void(null);" onmouseover = "window.status = 'About Us';return true;" onmouseout = "window.status = '';return true;"><img src="images/about_us.gif" width="101" height="25" border="0"></a></td>
<td><img src="images/seperator.gif" width="3" height="25"></td>
<td><a href="javascript:void(null);" onmouseover = "window.status = 'Contact';return true;" onmouseout = "window.status = '';return true;"><img src="images/contact.gif" width="114" height="25" border="0"></a></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/trans.gif" width="780" height="2"></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/sports_01.gif" width="284" height="50"></td>
<td><img src="images/sports_02.gif" width="285" height="50"></td>
<td><img src="images/sports_03.gif" width="211" height="50"></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/sports_04.gif" width="284" height="50"></td>
<td><img src="images/sports_05.gif" width="285" height="50"></td>
<td><img src="images/sports_06.gif" width="211" height="50"></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/sports_07.gif" width="284" height="49"></td>
<td><img src="images/sports_08.gif" width="285" height="49"></td>
<td><img src="images/sports_09.gif" width="211" height="49"></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/sports_10.gif" width="284" height="50"></td>
<td><img src="images/sports_11.gif" width="285" height="50"></td>
<td><img src="images/sports_12.gif" width="211" height="50"></td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0 "bgcolor="#e6e6e6">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;
<TABLE WIDTH=780 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD> <IMG SRC="images/spacer.gif" WIDTH=29 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=22 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=61 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=620 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=45 HEIGHT=1 ALT=""></TD>
<TD></TD>
</TR>
<TR>
<TD COLSPAN=5> <IMG SRC="images/price_02.gif" WIDTH=114 HEIGHT=1 ALT=""></TD>
<TD COLSPAN=3 ROWSPAN=2> <IMG SRC="images/price_03.gif" WIDTH=666 HEIGHT=37 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=4> <IMG SRC="images/contact_text.gif" WIDTH=113 HEIGHT=36 ALT=""></TD>
<TD> <IMG SRC="images/price_05.gif" WIDTH=1 HEIGHT=36 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=36 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=3> <IMG SRC="images/price_06.gif" WIDTH=52 HEIGHT=13 ALT=""></TD>
<TD COLSPAN=4> <IMG SRC="images/price_07.gif" WIDTH=683 HEIGHT=13 ALT=""></TD>
<TD ROWSPAN=2> <IMG SRC="images/price_08.gif" WIDTH=45 HEIGHT=14 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=13 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=2> <IMG SRC="images/price_09.gif" WIDTH=29 HEIGHT=408 ALT=""></TD>
<TD ROWSPAN=2> <IMG SRC="images/price_10.gif" WIDTH=22 HEIGHT=408 ALT=""></TD>
<TD COLSPAN=4 ROWSPAN=2 bgcolor="#9D9EA3" valign="top"> &nbsp;
<TABLE class=text3 cellSpacing=0 cellPadding=0 width=600
align=center border=0>
<TR>
<TD vAlign=middle align=left width=208>
<font size="1" face="Verdana">Use this form to contact
blkshirt.net in regards to any questions you may have about
our services.&nbsp; Please use this form if you want
blkshirt.net to set up your meet.</font></TD>
<TD width=392>
<CENTER>
<font face="verdana" size="1">Your Name:<br>
<input type="text" name="name" style="border: 1px solid #cccccc; background-color: #ffffff;">
<br>
<br>
Your E-mail Address:<br>
<input type="text" name="email" style="border: 1px solid #cccccc; background-color: #ffffff;">
<br>
<br>
Subject:<br>
<input type="text" name="subject" style="border: 1px solid #cccccc; background-color: #ffffff;">
<br>
<br>
Message:<br>
<textarea name="message" cols="40" rows="10" style="border: 1px solid #cccccc; background-color: #ffffff;"></textarea>
<br>
<br>
<input name="submit" type="submit" style="border: 1px solid #cccccc; background-color: #ffffff;" value="send">
</font>
</CENTER></TD></TR></TABLE></TD>
<TD ROWSPAN=3> <IMG SRC="images/price_12.gif" WIDTH=1 HEIGHT=409 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
</TR>
<TR>
<TD> <IMG SRC="images/price_13.gif" WIDTH=45 HEIGHT=407 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=407 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=3 ROWSPAN=2> <IMG SRC="images/price_14.gif" WIDTH=52 HEIGHT=15 ALT=""></TD>
<TD COLSPAN=3> <IMG SRC="images/price_15.gif" WIDTH=682 HEIGHT=1 ALT=""></TD>
<TD ROWSPAN=2> <IMG SRC="images/price_16.gif" WIDTH=45 HEIGHT=15 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=1 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=4> <IMG SRC="images/price_17.gif" WIDTH=683 HEIGHT=14 ALT=""></TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=14 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=8>&nbsp;</TD>
<TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=104 ALT=""></TD>
</TR>
</TABLE>
</td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0 "bgcolor="#e6e6e6">
<tr>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0 "bgcolor="#555a6e">
<tr>
<td width="107" height="27">&nbsp;</td>
<td width="52" height="27" class="footerMenu"><a href="javascript:void(null);" onmouseover = "window.status = 'Home';return true;" onmouseout = "window.status = '';return true;">HOME<a/></td>
<td width="109" height="27" class="footerMenu"><a href="javascript:void(null);" onmouseover = "window.status = 'Perry Running';return true;" onmouseout = "window.status = '';return true;">PERRY RUNNING</a></td>
<td width="70" height="27" class="footerMenu"><a href="http://www.blkshirt.net/forums/index.php" onmouseover = "window.status = 'Forums';return true;" onmouseout = "window.status = '';return true;">FORUMS</a></td>
<td width="75" height="27" class="footerMenu"><a href="javascript:void(null);" onmouseover = "window.status = 'myMeets';return true;" onmouseout = "window.status = '';return true;">MYMEETS</a></td>
<td width="75" height="27" class="footerMenu"><a href="javascript:void(null);" onmouseover = "window.status = 'Pricing';return true;" onmouseout = "window.status = '';return true;">PRICING</a></td>
<td width="78" height="27" class="footerMenu"><a href="javascript:void(null);" onmouseover = "window.status = 'About Us';return true;" onmouseout = "window.status = '';return true;">ABOUT US</a></td>
<td width="75" height="27" class="footerMenu"><a href="javascript:void(null);" onmouseover = "window.status = 'Contact';return true;" onmouseout = "window.status = '';return true;">CONTACT</a></td>
<td width="107" height="27">&nbsp;</td>
</tr>
</table>
<table width="780" border="0" cellpadding="0" cellspacing="0 "bgcolor="#555a6e">
<tr>
<td width="240" height="27">&nbsp;</td>
<td width="300" height="27" class="footerMenu">Copyright © 2003 blkshirt.com. All rights reserved.</td>
<td width="240" height="27">&nbsp;</td>
</tr>
</table>
</body>
</form>
</html>
Posted: Sat Dec 06, 2003 9:07 pm
by microthick
echo "<script>location.href=\"
http://www.blkshirt.net/thank_you.html"</script>";
See this line above?
You have to "escape" the last quotation mark after thank_you.html.
It must look like:
echo "<script>location.href=\"
http://www.blkshirt.net/thank_you.html\"</script>";
Posted: Sat Dec 06, 2003 9:11 pm
by blkshirt
It works great now...
Thank you so much for your help!