Jump to content

Menu sendemail form .php


ghi572000

Recommended Posts

This is what I have so far and when I go to send its no acknowledging is being recognised in the <option value=""></option> with or without the drop down menu selected.

 

The code I'm using in the post html below:

 

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

                        <?php

$ipi = getenv("REMOTE_ADDR");

$httprefi = getenv ("HTTP_REFERER");

$httpagenti = getenv ("HTTP_USER_AGENT");

?>

                        <input type="hidden" name="ip" value="<?php echo $ipi ?>" />

                        <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />

                        <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

                        <tr>

                          <td align="right">Title:</td>

                          <td> </td>

                          <td align="left"><select name="visitortitle">

                              <option>Please Select</option>

                              <option value="Mr">Mr</option>

                              <option value="Mrs">Mrs</option>

                              <option value="Miss">Miss</option>

                              <option value="Ms">Ms</option>

                              <option value="Dr">Dr</option>

                            </select>

                          </td>

                        </tr>

 

                        <td>

                                <label>

                                <input name="button" type="submit" id="button" value="Send" />

                                </label>

                        </td>

                        </tr>

                      </form>

 

 

Okay now the code I have in the sendemail php page:

 

<?php

 

$ip = $_POST['ip'];

$httpref = $_POST['httpref'];

$httpagent = $_POST['httpagent'];

$visitor = $_POST['visitor'];

$visitormail = $_POST['visitormail'];

$notes = $_POST['notes'];

$attn = $_POST['attn'];

 

 

if (eregi('http:', $notes)) {

die ("Please enter your message before you try submitting the form.");

}

 

if(isset($_POST['visitortitle']))  {$visitortitle = $_POST['visitortitle'];} else {$visitortitle = 'Nothing Selected';}

echo "<h2><br /><br /><br /><br />Please hit the back button and fill in your full name correctly<br />before you try submitting the form again.</h2>\n";

die ( '<a href="forum.html">click here go back and try again</a>' );

}

 

$from = "From: $visitor\r\n";

 

$message = " $todayis [EST] \n

Title: $visitortitle \n ";

 

mail("[email protected]", $visitortitle);

 

?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/218998-menu-sendemail-form-php/
Share on other sites

you have one to many closing brackets `}` in your if/else statement

 

change:

if(isset($_POST['visitortitle']))  {$visitortitle = $_POST['visitortitle'];} else {$visitortitle = 'Nothing Selected';}

 

to:

if(isset($_POST['visitortitle']))  {$visitortitle = $_POST['visitortitle'];} else {$visitortitle = 'Nothing Selected';

I'm still having a problem with the drop down menu list can anyone help?

 

The problem is that once I have selected a <option value=""></option> in my form the warning message appears as if I haven't selected anything and wont let me pass on to the next field entry in the form!

 

This is what I'm working with below, but the answers I have received so far have not solved my problem yet.

 

The code I'm using in the post html below:

 

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

                        <?php

$ipi = getenv("REMOTE_ADDR");

$httprefi = getenv ("HTTP_REFERER");

$httpagenti = getenv ("HTTP_USER_AGENT");

?>

                        <input type="hidden" name="ip" value="<?php echo $ipi ?>" />

                        <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />

                        <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

                        <tr>

                          <td align="right">Title:</td>

                          <td> </td>

                          <td align="left"><select name="visitortitle">

                              <option>Please Select</option>

                              <option value="Mr">Mr</option>

                              <option value="Mrs">Mrs</option>

                              <option value="Miss">Miss</option>

                              <option value="Ms">Ms</option>

                              <option value="Dr">Dr</option>

                            </select>

                          </td>

                        </tr>

 

                        <td>

                                <label>

                                <input name="button" type="submit" id="button" value="Send" />

                                </label>

                        </td>

                        </tr>

                      </form>

 

 

Okay now the code I have in the sendemail php page:

 

<?php

 

$ip = $_POST['ip'];

$httpref = $_POST['httpref'];

$httpagent = $_POST['httpagent'];

$visitor = $_POST['visitor'];

$visitormail = $_POST['visitormail'];

$notes = $_POST['notes'];

$attn = $_POST['attn'];

 

 

if (eregi('http:', $notes)) {

die ("Please enter your message before you try submitting the form.");

}

 

if(isset($_POST['visitortitle']))  {$visitortitle = $_POST['visitortitle'];} else {$visitortitle = 'Nothing Selected';}

echo "<h2><br /><br /><br /><br />Please hit the back button and fill in your full name correctly<br />before you try submitting the form again.</h2>\n";

die ( '<a href="forum.html">click here go back and try again</a>' );

}

 

$from = "From: $visitor\r\n";

 

$message = " $todayis [EST] \n

Title: $visitortitle \n ";

 

mail("[email protected]", $visitortitle);

 

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.