M_Gilliam Posted August 27, 2011 Share Posted August 27, 2011 Hello, I am have trouble in Chapter 5 Using Strings - Script 5.2 page 96. I created my php script but I cant seem to get my $last_name to "post" the last name. I get: Thank you, Manasseh last_name, for your posting: I downloaded the script for this excerise and it works but my script doesnt and I was wondering if someone can tell me what I am doing wrong. Im having a hard time distinguishing the difference between the 2 scripts. Books Script: <?php // Script 5.2 - handle_post.php /* This script receives five values from posting.html: first_name, last_name, email, posting, submit */ // Address error management, if you want. // Get the values from the $_POST array: $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $posting = $_POST['posting']; // Create a full name variable: $name = $first_name . ' ' . $last_name; // Print a message: print "<div>Thank you, $name, for your posting: <p>$posting</p></div>"; ?> My php script: <?php //Script 5.2 - handle_post.php // Display Errors ini_set ('display_errors', 1); error_reporting (E__ALL | E_STRICT); // Assigning Local Varibles $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $posting = $_POST['posting']; // Concantanating Varible $name = $first_name . ' ' . last_name; print "<div>Thank you, $name, for your posting: <p>$posting</p></div>"; ?> Any input would be appreciated. Link to comment Share on other sites More sharing options...
M_Gilliam Posted August 27, 2011 Author Share Posted August 27, 2011 /*** Link to comment Share on other sites More sharing options...
Craig-UK Posted August 27, 2011 Share Posted August 27, 2011 My php script: <?php //Script 5.2 - handle_post.php // Display Errors ini_set ('display_errors', 1); error_reporting (E__ALL | E_STRICT); // Assigning Local Varibles $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $posting = $_POST['posting']; // Concantanating Varible $name = $first_name . ' ' . $last_name; print "<div>Thank you, $name, for your posting: <p>$posting</p></div>"; ?> Any input would be appreciated. There is your problem, you have forgotten to include the $ Link to comment Share on other sites More sharing options...
M_Gilliam Posted August 27, 2011 Author Share Posted August 27, 2011 Thanks for the quick reply Craig-UK, That was the error. Cant believe i missed that, kind of embarrassing Link to comment Share on other sites More sharing options...
Craig-UK Posted August 27, 2011 Share Posted August 27, 2011 No problem we have all done it at some stage or another. Link to comment Share on other sites More sharing options...
Recommended Posts