code problems

This code for form on website drakecentre.com but can’t get to work at all, help appreciated!

[php]<?php
if($_POST[‘formSubmitRequest’] == “SubmitRequest”) {
// get name
$name = $_POST[‘name’];
// get address
$address = $_POST[‘address’];
// get phone_number
$phone_number = $_POST[‘phone_number’];
// get cell_number
$cell_number = $_POST[‘cell_number’];
// get email_address
$email_address = $_POST[‘email_address’];
// get event_date
$event_date = $_POST[‘event_date’];
// get event_time
$event_time = $_POST[‘event_time’];
// get attendance
$attendance = $_POST[‘attendance’];
// get banquet_room
$banquet_room = $_POST[‘banquet_room’];
// get both_rooms
$both_rooms = $_POST[‘both_rooms’];
// get bar_area
$bar_area = $_POST[‘bar_area’];
// get contact_name
$contact_name = $_POST[‘contact_name’];
// get phone_number
$phone_number = $_POST[‘phone_number’];
// get dvd
$dvd = $_POST[‘dvd’];
// get vhs
$vhs = $_POST[‘vhs’];
// get built-in_screen
$built-in_screen = $_POST[‘built-in_screen’];
// get built-in_projector
$built-in_projector = $_POST[‘built-in_projector’];
// get cable_tv
$cable_tv = $_POST[‘cable_tv’];
// get comcast_digital_radio
$comcast_digital_radio = $_POST[‘comcast_digital_radio’];
// get wireless_internet
$wireless_internet = $_POST[‘wireless_internet’];
// get wireless_mic
$wireless_mic = $_POST[‘wireless_mic’];
// get laptop
$laptop = $_POST[‘laptop’];
// get podium
$podium = $_POST[‘podium’];
// get white_board
$white_board = $_POST[‘white_board’];
// get keyboard
$keyboard = $_POST[‘keyboard’];
// get stage
$stage = $_POST[‘stage’];
// get dance_floor
$dance_floor = $_POST[‘dance_floor’];
// get questions
$questions = $_POST[‘questions’];
// get i_understand
$i_understand = $_POST[‘i_understand’];
// recipient
$to = "[email protected]";
// email subject
$subject = “Drake Centre Event Form”;
//$sender = “From: $email\r\n”;
// build message
$message = “Drake Centre Event Form.\n\n”;
$message .= “name: $name\n\n”;
$message .= “address: $address\n\n”;
$message .= “phone_number: $phone_number\n\n”;
$message .= “cell_number: $cell_number\n\n”;
$message .= “email_address: $email_address\n\n”;
$message .= “event_date: $event_date\n\n”;
$message .= “event_time: $event_time\n\n”;
$message .= “attendance: $attendance\n\n”;
$message .= “banquet_room: $banquet_room\n\n”;
$message .= “both_rooms: $both_rooms\n\n”;
$message .= “bar_area: $bar_area\n\n”;
$message .= “contact_name: $contact_name\n\n”;
$message .= “phone_number: $phone_number\n\n”;
$message .= “dvd: $dvd\n\n”;
$message .= “questions: $questions\n\n”;
$message .= “i_understand: $i_understand\n\n”;

mail($to, $subject, $message, $sender);
header (“Location: thankyou.html”);}
?>
[/php]

$sender is not set anywhere as It is commented out in your script.

Honestly just trying anything at this point, here’s what I’ve added but still does not send me an email:

// recipient

$to = "[email protected]";

// email subject

$subject = “Drake Centre Event Form”;
$webMaster = ‘[email protected]’;
$email = $_REQUEST[‘email’] ;
$message = $_REQUEST[‘message’] ;
$headers = “From: $email”;
$sent = mail($to, $subject, $message, $headers) ;
if($sent) {print “Your mail was sent successfully”; }
else {print “We encountered an error sending your mail”; }

$sender = “From: $email\r\n”;
$webMaster = ‘[email protected]’;

Get down to bare bones and see if mail is working at all. Just run the bare minimum mail function

mail("[email protected]",“My subject”,“My Message”;

If you are running it locally , you will need a mail server on your computer

Take a look at this post and see the code i posted up there for a similar problem :wink:
http://www.phphelp.com/forum/beginners-learning-php/contact-form-not-sending-data/msg84837/#msg84837

sorry not sure where to put that code (hence “newbie”) >:(
I am posting to a web site server that is up and running

This is the whole script. Put noting else in the page and run it. Just change the email to one you will get.

[php]<?php mail("[email protected]","My subject","My Message";)?>[/php]

  • Modified. Was missing closing bracket

tried that code you supplied and did not receive email. So maybe problems with html?
Here’s what I’m using in that file:

I said dont put anything else in it. If what I gave you didnt work by itself, they you have a mail server issue.

right I put that code in a php file by itself, uploaded it to the server. then using

in my html file.

Never mind. You cant follow simple instructions. For the THIRD time, run it ALL BY ITSELF. Paste that code into page BY ITSELF with a good email and then browse to that page. I cant explain it any simpler.

Kevin, this code is missing the closing bracket ) and i assume the OP has error reporting off so hence why the confusion.

To the OP, I have wrapped Kevin’s code in an if/else so you should at least see something.
[php]<?php
if(mail("[email protected]",“My subject”,“My Message”)) {
echo ‘sent’;
}
else {
echo ‘failed’;
}
?>[/php]

Hope that helps,
Red :wink:

[member=26967]Redscouse[/member] Typo. Thanks. I updated the post.

I’ve tried several PHP mail test scripts and get nothing returned, nothing in spam. Maybe still doing something wrong :’(

Then the problem is at the server level which I mentioned previously.

I’ve contacted the hosting company…waiting for response.

You’re welcome :wink:

not by email i hope - just kidding :stuck_out_tongue:

LMFAO!!! :smiley: :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service