-1

I am fairly new in PHP and I am facing this issue while practising PHP from a book -

Here is the HTML Code

        <form method="post" action="handle_post.php">
          <p>First Name:  <input type="text" name="first_name" size="20"></p>
                <p>Last Name: <input type="text" name="last_name" size="20"></p>
                <p>Email Address: <input type="email" name="email" size="30"></p>
                <p>Posting: 
                      <textarea name="posting" rows="5" cols="40">
                                        </textarea>
                 </p>
                <input type="submit" name="submit" value="Send My Fucking Email">                 
        </form>

Here is the PHP code .. when I am trying to make it work it is saying that something is wrong in this line -

$posting

I am pasting the code here .. let me know what is wrong in it

<?php

        date_default_timezone_set('Africa/Lagos');
        $first_name = $_POST['first_name']; 
        $last_name = $_POST['last_name']; 
        $posting =  $_POST['posting']; 
        $email = $_POST['email']; 

        $fullname = $first_name . ' ' . $last_name; 

        print "<div>Thank you my lord - $name, for your kind posting in this thread. This is the excerpt of the post: 
                    <p>$posting</p>
                    </div>";


        $fullname = urlencode((binary) $fullname); 
        $email = urlencode((binary) $email); 

        print "<p>Click <a href=\"thanks.php?name=$name&email=$email\">Here</a> to continue. </p>"; 



?>
u_mulder
  • 54,101
  • 5
  • 48
  • 64
danish deb
  • 111
  • 8

2 Answers2

1

You use the variable $name which not declared:

print "<div>Thank you my lord - $name, for your kind posting in this thread. This is the excerpt of the post: 
                <p>$posting</p>
                </div>";
Gouda Elalfy
  • 6,888
  • 1
  • 26
  • 38
0

Turn your print into echo when using variables like that.

VIDesignz
  • 4,703
  • 3
  • 25
  • 37