Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'chapter 2'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 4 results

  1. Hi everybody, I'm dusting off my PHP with this book. I'm using a kindle edition. In chapter 2 I can read: $months = [1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; This doesn't work for me (PHP 5.3.1) I think it should read: $months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  2. I have a modularized site in which all pages flow through the index.php. Login/logout works fine using sessions, in which a administrative level user must be logged for the "Admin" menu icon to appear in the menu. I have placed the 'admin' directory inside the 'module' directory. When a logged in user clicks "Admin," I am having difficulty preventing it from running the script (and thereby displaying the admin page) without first requiring a login. I have confirmed the directory is protected from direct access but not from running it. I know it must be a permissions setting, however, I cannot find what the correct permissions need to be. Is this possible? Below is the 'case' to load the admin panel over the index.php (again, the 'admin' directory is within the 'modules' directory): case 'admin-panel': $page = 'admin/admin-panel.inc.php'; $page_title = 'Admin Panel'; break; I can avoid this by simply having an admin_panel.php or index.php within a password protected 'admin' directory, however, I would like to keep the modular pattern and maintain the admin accessibility through the menu. Any suggestions would be appreciated.
  3. "will make it easier to refer to the variables when printing them" When who is printing them? the browser? and p 14 "To display the value of a variable, you can print the variable without quotation marks:" Meaning, I can ask the browser to print the variable? Or, I can type the variable (key) the variable w/o quotation marks? and then what do you mean by "you can print the variable without quotation marks" I mean-
  4. I just started going through the book and ran into my first problem while working through the end of chapter 2 in the Pursue section: The relevant part of Script 2.4 is: if (isset($_POST['gender'])) { $gender = $_POST['gender']; if ($gender == 'M') { echo '<p><b>Good day, Sir!</b></p>'; } elseif ($gender == 'F') { echo '<p><b>Good day, Madam!</b></p>'; } else { $gender = NULL; echo '<p class="error"><b>Gender should be either M or F!</b></p>'; } } else { $gender = NULL; echo '<p class="error"><b>You forgot to select your gender!</b></p>'; } I am using 'yes' and 'no' instead of 'M' and 'F' but this is the code that I used: if(isset($_POST['newsletter']) == 'yes') { echo "<p>Thank you for signing up for our monthly newsletter!</p>"; } elseif(isset($_POST['newsletter']) == 'no') { echo "<p>We are sorry you have decided NOT to sign up for our newsletter.</p>"; } else { echo "<p>You for got to choose a newsletter option!</p>"; } I know the hint suggested that I use the AND operator. The above code seems like it should work but ifelse(or the 'no') is printing the same as the if(or the 'yes') response and the else(where nothing is checked) is printing the correct response. In other words, When no is checked on the form it is saying "thank you for signing up" instead of "sorry you have decided to NOT..."
×
×
  • Create New...