Jump to content
Larry Ullman's Book Forums

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 post
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 post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...