Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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
Reply With Quote
  #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...

Reply With Quote
  #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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.