Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: PHP and MySQL 24-Hour Trainer
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 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 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.... )
Reply With Quote
  #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
Reply With Quote
The Following User Says Thank You to abeera_000 For This Useful Post:
MRGLENN (September 13th, 2012)
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 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



All times are GMT -4. The time now is 07:27 AM.


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