Jump to content
Larry Ullman's Book Forums

JasonHegarty

Members
  • Posts

    4
  • Joined

  • Last visited

JasonHegarty's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi all I recently purchased PHP and MySQL for Dynamic Web Sites and was starting to get a little lost by page 100 so decided I maybe should have started with PHP for the web. So today I am looking to either but the paperback copy (version 4) or the ebook but that only comes in version 3 - is this right or is version 4 out there somewhere I missed? Also two other questions am I right to start with PHP for the web. Is it easier to follow to a new learner? And is there much difference between verison 3 and 4? Thanks guys Jason
  2. Hi first time post - just got the book a couple of days ago - the book is great! Struggling to understand this though.. Step six asks you to write this script: //check comments were entered. if (!empty($_REQUEST['comments'])){ $comments = $_REQUEST['comments']; } else { $comments = NULL; echo '<p class ="error">What you don\'t want to comment afterall?</p>'; } //validate gender variable. if (isset($_REQUEST['gender'])){ $gender = $_REQUEST['gender']; if ($gender == 'M') { $greeting = '<p><b>Good day, sir!</b></p>'; } elseif ($gender == 'F') { $greeting = '<p><b>Good day, Madam!</b></p>'; } else { $gender = NULL; echo '<p class = "error">Gender should be either "M" or "F"!</p>'; } Why would you create $greeting which is different depending on the answer stored in the $gender when echo would do? Am I missing something here? Also its the first time $greeting has been mentioned in this script and I can't see it referenced elsewhere which up until this point when a new variable has been introduced the book has explained what it is storing or doing. Help! One other thing - if the user writes in the comments box the following: 'I didn't realise it was Sunday today' it is output after successful submission as 'I didn\'t realsie is was Sunday today' Anyway to fix this so that the \ isn't output?
×
×
  • Create New...