Jump to content
Larry Ullman's Book Forums

Chapter 5 Using Strings


Recommended Posts

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

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

 Share

×
×
  • Create New...