M_Gilliam 0 Posted August 27, 2011 Report 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. Quote Link to post Share on other sites
M_Gilliam 0 Posted August 27, 2011 Author Report Share Posted August 27, 2011 /*** Quote Link to post Share on other sites
Craig-UK 8 Posted August 27, 2011 Report 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 $ Quote Link to post Share on other sites
M_Gilliam 0 Posted August 27, 2011 Author Report Share Posted August 27, 2011 Thanks for the quick reply Craig-UK, That was the error. Cant believe i missed that, kind of embarrassing Quote Link to post Share on other sites
Craig-UK 8 Posted August 27, 2011 Report Share Posted August 27, 2011 No problem we have all done it at some stage or another. Quote Link to post Share on other sites
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.
Note: Your post will require moderator approval before it will be visible.