Click to See Complete Forum and Search --> : php problems for email form


catweasle
05-07-2003, 03:45 AM
with help from members of this forum I have tried to construct a php based system whereby with the click of a button a form pops up with multiple feilds for email addreses and names and a box with set message in it, when send is clicked it emails the desired recipients. My problems are that even though my server says PHP4 is enabled any page with a PHP extension appears balnk in my browser after taking more than the usual time to load. if I put a html extension on the button and form pages they appear but the refer.php page to handle the info comes up blank and dosen't send the mail.

do all pages involved have to have the php extension?
Is it a mac problem?

here are my pages maybe they aren't correct.

(THE BUTTON TEST PAGE)

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <a href="etest.html?<?_echo_$_SERVER['PHP_SELF'];_?>">form
test</a>
</body>
</html>

(THE FORM TEST PAGE)

<html>

<head><title>Send this page to a friend</title></head>



<style>

.formbox {

____BORDER-RIGHT: 2px groove; BORDER-TOP: 2px groove; BORDER-LEFT: 2px groove; BORDER-BOTTOM: 2px groove; FONT-SIZE: 8pt; BACKGROUND: #ffffff; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif

}

.formbut {

____BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; FONT-SIZE: 8pt; BACKGROUND: #dddddd; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif

}

</style>



<body bgcolor="#eeeeee">

<center>

Thank you for sending a link to this page to a friend. We hope they will enjoy it.



<form action="refer.php" method="post">

__<p>Cover.ie:

____<?php_$fullurl_=_"http://www.cover.ie".$_SERVER['QUERY_STRING'];

_echo_"<a_href='txt.html'>txt</a>"_;

_echo"<input_type='hidden'_name='link'_value=text.html>";?>

____<br>

____<br>

__</p>

__<table width="27%" border="0" cellspacing="0" cellpadding="0">

____<tr>

______<td width="50%">Friend's_Name:</td>

______<td width="50%">

<input type="text" name="name" class="formbox">

______</td>

____</tr>

____<tr>

______<td>Friend's_E-mail:</td>

______<td><input type="text" name="email" class="formbox"></td>

____</tr>

____<tr>

______<td>Your_Name:</td>

______<td><input type="text" name="sendername" class="formbox"></td>

____</tr>

____<tr>

______<td>Your_E-mail:</td>

______<td><input type="text" name="senderemail" class="formbox"></td>

____</tr>

__</table>

__<p> Your Message:<br>

____<textarea name="message" cols="50" rows="5" class="formbox">this is the text of your message</textarea>

____<br>

____<input type="submit" value="Send Page" class="formbut">

____<input type="reset" value="Reset" class="formbut">

____<input type="button" value="Back to Page" class="formbut" onClick="history.go(-1)">

__</p>

__</form>

__</center>

</body>

</html>


(THE REFER PAGE)

<html>

<head><title>Send this page to a friend</title></head>

<style>

.formbut {

____BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; FONT-SIZE: 8pt; BACKGROUND: #dddddd; COLOR: #000000; FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif

}

</style>


<body bgcolor="#eeeeee">
<?

mail($_POST['email'],_$_POST['sendername']." thought you would enjoy this page","Hi ".$_POST['name']."!\n\n".$_POST['sendername']." (".$_POST['senderemail'].") thought you would enjoy the page found at ".$_POST['link'].".\n\nThey wrote the following message to you:\n\n".$_POST['message']."",_"from: ".$_POST['senderemail']."\r\n");

echo_"<div align=\"center\"><table width=\"96%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" ";

echo_"style=\"font-size:11pt;font-color:black;\">";

echo_"<tr height=\"40\" align=center><td><p>_</p></td></tr>";



echo_"<tr><td >An e-mail was sent to ".$_POST['name']." (<a href=\"mailto:".$_POST['email']."\">".$_POST['email']."</a> ), we hope they will enjoy the page at";

echo_" <a href=".$_POST['link']." target=_blank>".$_POST['link']." </a><br><br>Your message was:<br>".$_POST['message']."";

echo_"<CENTER><FORM><INPUT type='button' value='Back to Page' class='formbut' onClick='history.go(-2)'></FORM></CENTER>";

echo_"</td></tr></table></div>";

?>

</body>

</html>

CyCo
05-07-2003, 08:26 AM
Your host may say that PHP4 is enabled, but to test it, save the following code as hellophp.php then upload and test.

<HTML><BODY>
<?php echo "Hello world from PHP<br>\n"; ?>
<?php echo "Today is ", date("F j, Y, g:i a"), "<br>\n"; ?>
<?php echo "PHP_VERISON ", PHP_VERSION, "<br>\n"; ?>
<?php echo "PHP_INFO ", phpinfo(), "<br>\n"; ?>
</BODY></HTML>