Re: why isn't php being parsed?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

First, prolly, your file needs to be called chair1.php instead of chair.html...

Second, you should add something in the lines of:

if (isset($_POST["submit"])) {

.... email sending code here...

}

If not, the users, when they reach the page will send an empty form to the email...

Cheers,
Luis Ferro



Patrick Roane wrote:

I am trying to include form-parsing code on the same
page as my hard-coded HTML form- but I'm doing
something wrong. The name of my file is chair1.html

Please see below:

thanks!



<!DOCTYPE html PUBLIC
	"-//W3C//DTD XHTML 1.0 Strict/EN"
	"http://www/w3/org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
<head>
<title>form</title>
<link rel="stylesheet" type="text/css" media="screen"
href="center.css">
<style type="text/css">


</style> </head> <body bgcolor="#999900"> <table border="0" cellpadding="5" width="100%" bgcolor="#999900" class="rightsidebar"><tr> <td>&nbsp</td> <td align="center"><div id="whitetitle">Item Ch1-1</div></td> <td>&nbsp;&nbsp;&nbsp</td>

<body bgcolor="#999900">

<table border="0" cellpadding="0" width="100%"
align="left" bgcolor="#999900"
class="rightsidebar"><tr><td>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>&nbsp</td>

<td><img src="chair_pics/rt_chair.jpg" alt=""
height="304" width="160" border="0"
align="right"></td>
<td>&nbsp</td>
<td align="left"><ul>


<li>&#187; Arm Chair</li> <li>&#187; Beach wood</li>
<li>&#187; Height: 42"</li> <li>&#187; Seat: 19"w x 18 1/2d</li>


<td>&nbsp</td>
<td>&nbsp</td>
<td>&nbsp</td>


</ul> </td> </tr>

</table>
<table border="0" cellpadding="0" width="100%"
align="left" bgcolor="#999900"><tr><td>


<?php $to = "fojomo@xxxxxxxxx"; //Change to the email you
want the form results to be sent to


$subject = "Form Results"; //Change to what you want
the title of the email to be

$headers = "From: Form Mailer";

$thankyouURL = "http://www.crost.com/test/index.html";;
//Change to the url you want the form to go to after
submit

$date = date ("l, F jS, Y"); $time = date ("h:i A");

$msg = "Submitted on $date at $time.\n\n";


if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; }
} else {
foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; }
}


mail($to, $subject, $msg, $headers);
header ("Location:$thankyouURL");

?>



<fieldset><legend align="center">Questions &
Comments</legend><br>


<form method="post" action="{' . $_SERVER['PHP_SELF'] . '}"> <input type="checkbox" name="Ch1-1[]" value="Ch1-1" />I'd like to purchase Item Ch1-1: <input type="checkbox" name="similar_1[]" value="similar_1" />Do you have something similar? <input type="checkbox" name="browse_1[]" value="browse_1" />Just browsing: <p>Name:<br /> <input type="text" name="user" /></p> <p>Phone:<br /> <input type="text" name="phone" /></p><br /> Comments:<br /> <textarea name="Comments" rows="5" cols="40"></textarea></fieldset>

<p><input type="submit" value="submit data" /></p>
</form>
</tr>
</td>
</table>
</body>
</html>


=====

----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. You can do this if you try. All that I want for you my son, is to be satisfied"

 ~ Lynard Skynard




-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux