Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
 
Old July 14th, 2006, 12:05 AM
Registered User
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 page 151

Hi guys,

Need your help here. I get this error on chapter 5 page 151

Notice: Undefined index: step in /var/www/debian.com/public_html/movie/form4.php on line 19

Code as downloaded from the site:

<?php
// Debug info Display
function debugDisplay(){
?>
<PRE>
$_POST
<?php
   print_r($_POST);
?>
$_GET
<?php
   print_r($_GET);
?>
</PRE>
<?php
}

// Switch on search/add wizard step
switch( $_GET['step']){
// #################
// Search/Add form
// #################
   case "1":
      $type = explode(":",$_POST['type']);
      if ($_POST['Submit']=="Add"){
         require($_POST['Submit'].$type[0].'.php');
      } else {
         if ( $_POST['type'] == "Movie:Movie" &&
              $_POST['MovieType'] == ""){
            header("Location:form4.php");
         }
?>
<h1>Search Results</h1>
<p>You are looking for a "<?php echo $type[1]?>" named "<?php echo $_POST['Name']?>"</p>
<?php
      }
      if ($_POST['Debug'] == "on"){
         debugDisplay();
      }
      break;
// #################
// Add Summary
// #################
   case "2":
      $type = explode(":",$_POST['type']);
?>
<h1>New <?php echo $type[1]?> : <?php echo $_POST['Name']?></h1>
<?php
      switch( $type[0] ){
         case "Movie":
?>
<p>Released in <?php echo $_POST['MovieYear']?></p>
<p><?php echo nl2br(stripslashes($_POST['Desc']))?></p>
<?php
            break;
         default:
?>
<h2>Quick Bio</h2>
<p><?php echo nl2br(stripslashes($_POST['Bio']))?></p>
<?php
            break;
      }
      break;
// ###############
// Starting form
// ###############
   default:
      require('startform.php');
      break;
}
?>

Thanks a lot. This book really teaches you more of debugging than of learning PHP.

 
Old July 26th, 2006, 10:39 AM
Authorized User
 
Join Date: Jul 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello. I think you are missing this code (which should go just before the "switch" code):
if (!isset($_GET['step']))
{
    require('startform.php');
}
else
{

 
Old July 26th, 2006, 05:53 PM
Registered User
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I guess i'll try inserting the IF statement. Thanks a lot for the help.

 
Old July 27th, 2006, 02:52 PM
Authorized User
 
Join Date: Jul 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your welcome. That would do it (let me know if you have other issues - Ijust finished Chptr 5 and got it all working.

 
Old July 27th, 2006, 06:38 PM
Registered User
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by tbrown
 Your welcome. That would do it (let me know if you have other issues - Ijust finished Chptr 5 and got it all working.

Hi Thrown,

It worked!...thanks a lot that was so helpful of you.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Chapter 2 First Page xtiano77 ASP.NET 3.5 Basics 1 May 7th, 2008 01:00 AM
Chapter 5 p, 151"select3" application [email protected] BOOK: Beginning Ruby on Rails 2 August 19th, 2007 08:45 PM
Chapter 5 Page 151 angelojr BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 2 June 12th, 2007 08:15 AM
Mistake in code on page 151 MythicalMe BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 May 22nd, 2006 01:11 PM
Chapter 1 Page 16 - Try It Out bradnerdhss BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 January 31st, 2006 02:11 PM





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