Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 9th, 2006, 07:22 PM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code chapter 5 pg 145-146

When I typed all of the cose for form3.php and formprocess.php and entered the information in the book, I press Submit and I dont get the page, what I get is a URL http://form3.php/formprocess3.php. Now if I save the form3 as an html file it works flawlessly am I doing something wrong? Here is the code for both

Form3.php
<html>
<head>
<title>Add/Search Entry</title>
<style type="text/css">
TD{color:#353535;font-family:verdana}
TH{color:#FFFFFF;font-family:verdana;background-color:#336699}
</style>
</head>
<body>
<form action="formprocess3.php" method="post">
<table border="0" cellspacing="1" cellpadding="3"
       bgcolor="#353535" align="center">
  <tr>
    <td bgcolor="#FFFFFF" width="50%">Name</td>
    <td bgcolor="#FFFFFF" width="50%">
      <input type="text" name="Name">
    </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">What you are looking for</td>
    <td bgcolor="#FFFFFF">
      <select name="MovieType">
        <option value="" selected>Select a movie type...</option>
        <option value="Action">Action</option>
        <option value="Drama">Drama</option>
        <option value="Comedy">Comedy</option>
        <option value="Sci-Fi">Sci-Fi</option>
        <option value="War">War</option>
        <option value="Other">Other...</option>
      </select>
    </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">Add what?</td>
    <td bgcolor="#FFFFFF">
      <input type="radio" name="type" value="Movie" checked>
      Movie<br>
      <input type="radio" name="type" value="Actor">
      Actor<br>
      <input type="radio" name="type" value="Director">
      Director<br>
    </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" width="50%">Display Debug info</td>
    <td bgcolor="#FFFFFF" width="50%">
      <input type="checkbox" name="Debug" checked>
    </td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" colspan=2 align="center">
      <input type="submit" name="Submit" value="Search">
      <input type="submit" name="Submit" value="Add">
    </td>
  </tr>
</table>
</form>
</body>
</html>

formprocess3.php
<?php
if ($_POST['type'] == "Movie" && $_POST['MovieType'] == "") {
  header("Location:form3.php");
}
$title = $_POST['Submit'] . " " .
         $_POST['type'] . " : " .
         $_POST['Name'];
?>
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<?php
  if ($_POST['Debug'] == "on") {
?>
<pre>
<?php
    print_r($_POST);
?>
</pre>
<?php
  }
  $name = $_POST['Name'];
  $name[0] = strtoupper($name[0]);
  if ($_POST['type'] == "Movie") {
    $foo = $_POST['MovieType'] . " " . $_POST['type'];
  } else {
    $foo = $_POST['type'];
  }
?>

<p align="center">
  You are <?php echo $_POST['Submit']; ?>ing
  <?php echo $_POST['Submit'] == "Search" ? "for " : ""; ?>
  a <?php echo $foo; ?>
  named "<?php echo $name; ?>"
</p>
</body>
</html>

I'm getting kinda code
  #2 (permalink)  
Old July 9th, 2006, 07:45 PM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh also I used the downloaded code from this site and it didnt work either

I'm getting kinda code
  #3 (permalink)  
Old July 17th, 2006, 01:56 AM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would say that I can see no reason for Form3 to be a php file, as it's pure HTML. I would stay using it as a HTML file, and continue on...

  #4 (permalink)  
Old August 25th, 2006, 08:33 PM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

According to the errata list:

a<?php echo $foo; ?>
should be:
a<?php echo $foo ?>


this near the bottom of the file. Haven't quite got to that one yet.

luciano



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 pg 95 al2000 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 August 4th, 2008 09:18 PM
Try It Out Page 146 Chapter 5 sosborne BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 August 7th, 2006 05:53 PM
Chapter 4 pg 131 cpkaiser BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 May 2nd, 2004 01:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.