Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: PHP and MySQL 24-Hour Trainer
This is the forum to discuss the Wrox book PHP and MySQL 24-Hour Trainer by Andrea Tarr ; ISBN: 978-1-1180-6688-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL 24-Hour Trainer 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 June 9th, 2012, 01:27 PM
Registered User
Points: 43, Level: 1
Points: 43, Level: 1 Points: 43, Level: 1 Points: 43, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 7
Thanks: 1
Thanked 1 Time in 1 Post
Default Chapter 11 FORMS - Index Error

Lesson 11 Forms (Error Message )

When Running: Exercise 11a get

Error Message : Undefined index FtoC on line 8

as well as index CtoF on line 13


Code is:

<?php
require_once("exercise11b.php");
$answer = '';






if ($_POST['FtoC'] ) // Line 8
{
$answer = convertFtoC((float) $_POST['temperature']);
}

elseif ($_POST['CtoF']) // Line 13
{
$answer = convertCtoF((float) $_POST['temperature']);
}



?>

------------------------------------------------------

It Calculates Ok but PHP does Not Understand the

['FtoC'] & ['CtoF'] Index's

It Appears something is Missing (Not Initialized)

(Could Not Find any Info in Book about Debugging this Problem.... )
  #2 (permalink)  
Old August 5th, 2012, 06:42 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi :

replace your code with :

<?php
$answer='';
if (isset($_POST['FtoC'])){
$answer=convertFtoC((float) $_POST['temperature']);
} elseif (isset($_POST['CtoF'])) {
$answer=convertCtoF((float) $_POST['temperature']);
}
?>

cheers
The Following User Says Thank You to abeera_000 For This Useful Post:
MRGLENN (September 13th, 2012)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 11 semantic error pg 295 notig BOOK: Beginning Visual C# 2010 0 September 28th, 2010 01:29 PM
Error in Chapter 11 JGPatrick BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 1 January 17th, 2010 04:49 PM
Runtime Error from Chapter 11 Code winkle BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 April 22nd, 2009 02:41 PM
Chapter 11: Error while updating user data pherank BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 March 16th, 2008 07:03 PM
Error in Chapter 11 Sample Code josevi BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 February 1st, 2008 01:43 PM





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