adriscoll Posted April 30, 2011 Share Posted April 30, 2011 Hello. I am trying to pass along a variable in an email auto response ($park), however if the variable is 2 words then it only passes along the first word. Any info would be great. <?php $to = "$email"; $subject = "Event Signup Confirmation"; $message = "Hello $firstname! Thank you for signing up to work the $park event. Someone will contact you shortly. Event Information Park: $park Date: $orderdate Time: $hour:$min $ampm Description: $description Crew Leader: $leader"; $from = "guy@xxxx.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Thank you for signing up. You will receive an email shortly letting you know event details and who your crew leader is."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/ Share on other sites More sharing options...
wildteen88 Posted April 30, 2011 Share Posted April 30, 2011 Where are you setting the variables $email, $firstname, $park, $orderdate, $hour, $min $ampm, $description and $leader from? Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/#findComment-1208596 Share on other sites More sharing options...
adriscoll Posted May 12, 2011 Author Share Posted May 12, 2011 The first file (webform) is getting the information from url link on a preceeding page. It displays the information correctly as someone sees the detail and enters in their personal info to sign up. From there, it passes the variables as 'hidden' to a backend file that inserts info into the DB. They then get an autoresponse, but the autoresponse is cutting off the 2nd word of any entries with multiple words in the text field. Fields effected are: Description, crew leader, meetingplace (really any with 2 words) <?php include('dbconfig.php'); $event_id = $_GET['id']; $park = $_GET['park']; $orderdate = $_GET['orderdate']; $meetingPlace = $_GET['meetingPlace']; $description = $_GET['description']; $leader = $_GET['leader']; $hour = $_GET['hour']; $min = $_GET['min']; $ampm = $_GET['ampm']; $sponsor = $_GET['sponsor']; echo "Date: $orderdate"; echo "<BR>"; echo "Park: $park"; echo "<BR>"; echo "Description: $description"; echo "<BR>"; echo "Meeting Place: $meetingPlace"; echo "<BR>"; echo "Crew Leader: $leader"; echo "<BR>"; echo "Sponsor: $sponsor"; echo "<BR>"; echo "Start Time: $hour"; echo ":"; echo $min; echo $ampm; ?> <body> <form enctype="multipart/form-data" action="volunteerDB.php" method="POST" name="myform"> <table border="1"> <input type="hidden" name="event_id" value=<?php echo $event_id; ?>> <input type="hidden" name="park" value=<?php echo $park; ?>> <input type="hidden" name="orderdate" value=<?php echo $orderdate; ?>> <input type="hidden" name="description" value=<?php echo $description; ?>> <input type="hidden" name="meetingPlace" value=<?php echo $meetingPlace; ?>> <input type="hidden" name="leader" value=<?php echo $leader; ?>> <input type="hidden" name="sponsor" value=<?php echo $sponsor; ?>> <input type="hidden" name="hour" value=<?php echo $hour; ?>> <input type="hidden" name="min" value=<?php echo $min; ?>> <input type="hidden" name="ampm" value=<?php echo $ampm; ?>> <tr> <td>First Name</td> <td> <input name="firstname" /> </td> </tr> <tr> <td>Last Name</td> <td> <input name="lastname" /> </td> </tr> <tr> <td>Email</td> <td> <input name="email" /> </td> </tr> <tr> <td>Phone</td> <td> <input name="phone" /> </td> </tr> <tr> </tr> </table> <input type="submit" value="Sign Up" onclick="verify();"> </td> </tr> </form> </body> the backend file is: <?php include('dbconfig.php'); $event_id = $_POST['event_id']; $park = $_POST['park']; $orderdate = $_POST['orderdate']; $meetingPlace = $_POST['meetingPlace']; $description = $_POST['description']; $leader = $_POST['leader']; $sponsor = $_POST['sponsor']; $hour = $_POST['hour']; $min = $_POST['min']; $ampm = $_POST['ampm']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $email_list = $_POST['email_list']; // Make a MySQL Connection mysql_connect("localhost", "$user", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); // Insert a row of information into the table "example" mysql_query("INSERT INTO volunteer (id, event_id, park, firstname, lastname, email, phone, email_list) VALUES('', '$event_id', '$park', '$firstname', '$lastname', '$email', '$phone', '$email_list') ") or die(mysql_error()); ?> <?php $to = "$email"; $subject = "Trailworker Event Signup Confirmation"; $message = "Hello $firstname! Thank you for signing up to work the '$park' trailworker event listed below. If you have any questions, please visit the Volunteer page on the Trailworkers website at http://www.trailworkers.com/index.php/volunteer and click on the event crew leader's personal contact link to open a message form. Volunteer Event Information Park: $park Date: $orderdate Time: $hour:$min $ampm Meeting Place: $meetingPlace Description: $description Crew Leader: $leader Sponsor: $sponsor"; $from = "crewleader@xxx.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Thank you for signing up. You will receive an email shortly letting you know event details and who your crew leader is."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/#findComment-1214597 Share on other sites More sharing options...
wildteen88 Posted May 12, 2011 Share Posted May 12, 2011 Is because you have invalid html <input type="hidden" name="event_id" value=<?php echo $event_id; ?>> <input type="hidden" name="park" value=<?php echo $park; ?>> <input type="hidden" name="orderdate" value=<?php echo $orderdate; ?>> <input type="hidden" name="description" value=<?php echo $description; ?>> <input type="hidden" name="meetingPlace" value=<?php echo $meetingPlace; ?>> <input type="hidden" name="leader" value=<?php echo $leader; ?>> <input type="hidden" name="sponsor" value=<?php echo $sponsor; ?>> <input type="hidden" name="hour" value=<?php echo $hour; ?>> <input type="hidden" name="min" value=<?php echo $min; ?>> <input type="hidden" name="ampm" value=<?php echo $ampm; ?>> HTML attribute values should be wrapped in quotes, eg value="<?php echo $meetingPlace; ?>" Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/#findComment-1214602 Share on other sites More sharing options...
adriscoll Posted May 12, 2011 Author Share Posted May 12, 2011 If that were the case, how is it that single word values make it through fine? Shouldn't it all be broken? I'll test it in the mean time. Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/#findComment-1214627 Share on other sites More sharing options...
cyberRobot Posted May 12, 2011 Share Posted May 12, 2011 If you don't use the quotes, the attribute value is considered everything up to the first space character Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/#findComment-1214631 Share on other sites More sharing options...
adriscoll Posted May 12, 2011 Author Share Posted May 12, 2011 The quotes did the trick. I still don't entirely comprehend how partial values passed through, but it works. Thanks a ton wildTeen88. Quote Link to comment https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/#findComment-1214632 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.