Jump to content

Added a drop down to HTML but how to update PHP?


Wilderrness

Recommended Posts

I would really appreciate some HELP!!! here. I created a very simple feedback/enquiry form for my website using form wizard so my on-line enquiry form works with a php doc to go with it but now I've added a drop down menu how do I get the php doc to reflect these options:

Here's some of the HTML:

 

<form action="feedback.php" method="post">
<select name="date"> 
<option selected="selected">Choose your time from the list:</option>
<option>111111111</option>
<option>222222222</option>
<option>333333333</option>
</select>
Name:<input type="text" name="name" size="25" />
Email address:<input type="text" name="email" size="25" />
Comments<textarea rows="15" cols="45" name="comments"></textarea>
<input type="submit" value="Submit" /><input type="reset" value="Reset"> 

Here's the php which needs the drop down code added:

<?php
// ------------- CONFIGURABLE SECTION ------------------------
$mailto = 'my email' ;

$subject = "departure dates" ;

$formurl = "http://www.xxxxxxxx" ;
$errorurl = "http://www.xxxxxx/error.htm" ;
$thankyouurl = "http://www.xxxxx/thankyou.htm" ;

$uself = 1;
$email_is_required = 1;
$name_is_required = 1;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
if (empty($email)) {
$email = $mailto ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.10.1" );
header( "Location: $thankyouurl" );
exit ;

?>

By the way I am not using a data base, I will just update the HTML and php each week and upload them again, because I wouldn't know where to start with sql.

 

Hi,

 

Please place your code in the code block next time

 

I added some code check within the /////// marks

 

 

 

 

<?php
// ------------- CONFIGURABLE SECTION ------------------------
$mailto = 'my email' ;

$subject = "departure dates" ;

$formurl = "http://www.xxxxxxxx" ;
$errorurl = "http://www.xxxxxx/error.htm" ;
$thankyouurl = "http://www.xxxxx/thankyou.htm" ;

$uself = 1;
$email_is_required = 1;
$name_is_required = 1;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}
if (empty($email)) {
$email = $mailto ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}
/////////////////////////////////////////////////
$comments =. "<strong>Selected time:</strong> $_POST[date]\n\n <br><br>";

//////////////////////////////////////////////
$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.10.1" );
header( "Location: $thankyouurl" );
exit ;

?>

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.