View Full Version : Form help

02-13-2006, 10:10 PM
I have been having trouble with my form.

Here is what I have for my contact page...

<form action="admin/action.php" method="post">
Your e-mail:
<input type="text" name="email">
<p>Type of message:<br>
<input type="radio" name="type" value="comment"> Comment
<input type="radio" name="type" value="question"> Question
<input type="radio" name="type" value="complaint"> Complaint<p>
<textarea name="message" rows="10" cols="30">
<INPUT type="submit" value="Send"> <INPUT type="reset">


Here is what I have for admin/action.php...

$type = $_POST["type"];
$message = $_POST["message"];
$email = $_POST["email"];
mail("smrpgx@gmail.com", "$type", "$message $REMOTE_ADDR $email")

Can someone tell me what I am doing wrong? I'm new at this stuff so please don't point and laugh at me.

02-14-2006, 02:53 AM
Are you getting an error or what? Please provide a little more detail about the problem you're having.

02-14-2006, 09:27 AM
Not sure if that helps but $REMOTE_ADDR only works with register_globals on, since you however use $_POST I assume it is off :)

To get the sender's IP address, use $_SERVER['REMOTE_ADDR'] :)

I doubt it'd do much but perhaps try:

$target = "smrpgx@gmail.com";
$type = $_POST["type"];
$message = $_POST["message"]."\n\n".$_SERVER['REMOTE_ADDR']."\n\n".$_POST["email"];
mail($target, $type, $message, "From: Scriptmailer <noreply@none.com>\nX-Mailer: PHP/" . phpversion());)