Jump to content

Recommended Posts

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.";


?>

Link to comment
https://forums.phpfreaks.com/topic/235165-only-returning-partial-value/
Share on other sites

  • 2 weeks later...

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.";

?>

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; ?>"

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.