Quote:
Originally posted by Canadianxtreme
can anyone help me with my PHP problem
the problem that i am having is that everytime someone submits the form. it comes to a page that lists all the form fields and says:
Undefined Variable ......
and so on..
|
So what are the Undefined Variables? That is a good place to start. Also have you checked your script for syntax errors really close. I don't do web pages, but I may be able to help if you can give me some more information about what is going on in your script. I usually do VB or Lotus Script.
Does this help
<?php
// Add as many Names/ Departments -- e-mail addresses as you want here
$eMail[] = array( 'Information', 'info@bogus.dom' );
$eMail[] = array( 'TechSupport', 'support@bogus.dom' );
$eMail[] = array( 'Billing Questions', 'billing@bogus.dom' );
?>
<HTML>
<HEAD>
<TITLE>Mail Me!</TITLE>
</HEAD>
<BODY>
<?php if( ! isset( $HTTP_POST_VARS["EMail"] ) ) { ?>
<form method="POST" name="MailForm">
<div align="center">
<center>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" align="right">To:</td>
<td><select size="1" name="To">
<?php
foreach( $eMail as $k => $a )
echo "<option value=\"$k\">$a[0]</option>\n";
?>
</select></td>
</tr>
<tr>
<td valign="top" align="right">From:</td>
<td><input type="text" name="From" size="44" maxlength="32"></td>
</tr>
<tr>
<td valign="top" align="right">E-Mail:</td>
<td><input type="text" name="EMail" size="44"></td>
</tr>
<tr>
<td valign="top" align="right">Subject: </td>
<td>
<p align="center"><input type="text" name="Subject" size="44"></td>
</tr>
</table>
</center>
</div>
<p align="center"><textarea rows="10" name="Body" cols="45"></textarea></p>
<p align="center"><input type="submit" value="Send" name="B1"></p>
</form>
<?php
} else {
echo "<B>Attempting to send message</b></BR></BR>\n";
if( mail( '"' . $eMail[$HTTP_POST_VARS["To"]][0] . '" <' . $eMail[$HTTP_POST_VARS["To"]][1] . '>',
$HTTP_POST_VARS["Subject"], $HTTP_POST_VARS["Body"],
'Return-Path: "' . $HTTP_POST_VARS["From"] . '" <' . $HTTP_POST_VARS["EMail"] . ">\n"
. 'From: "' . $HTTP_POST_VARS["From"] . '" <' . $HTTP_POST_VARS["EMail"] . ">\n"
. 'Reply-To: "' . $HTTP_POST_VARS["From"] . '" <' . $HTTP_POST_VARS["EMail"] . ">\n"
. "X-Mailer: PHP/" . phpversion() . "\n"
. "X-From-IP: " . $REMOTE_ADDR ) )
echo "Message Sent Successfully";
else
echo "UNABLE To Send Message.";
}
?>
</BODY>
</HTML>
--------- Script Ends Here --------