Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > BOOK: Dreamweaver MX: PHP Web Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Dreamweaver MX: PHP Web Development
This is the forum to discuss the Wrox book Dreamweaver MX: PHP Web Development by Gareth Downes-Powell, Tim Green, Bruno Mairlot; ISBN: 9780764543876
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Dreamweaver MX: PHP Web Development 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 Display Modes
  #1 (permalink)  
Old December 3rd, 2003, 04:54 PM
Registered User
 
Join Date: Dec 2003
Location: Salt Lake City, UT, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parse Error with change_booking_details.php

I've completed all the files in the Hotel Registration project including the change_booking_details.php file and am now testing from the beginning of the booking process. The correct booking shows up in confirm_booking.php but when I try to make a correction, I get this message:

Parse error: parse error, unexpected '[' in c:\program files\apache group\apache\htdocs\karen\dreamweaverhotel\booking s2\change_booking_details.php on line 50

My code looks like this:

  mysql_select_db($database_dreamweaverhotel, $dreamweaverhotel);
  $Result1 = mysql_query($updateSQL, $dreamweaverhotel) or die(mysql_error());

  $updateGoTo = "booking_updated.php? ID=" . HTTP_POST_VARS['bookingID'] . "&clientID=" . HTTP_POST_VARS['clientID'] . "";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
 with line 50 at the $updateGoTo.

The book on p. 145 has instructions for putting a submit button in the form but the illustration on the next page has a link. I've tried it both ways but still get the same error message.

My questions: What is going on here and do I need to make changes in the code that's offered in the book?

Thanks,

Reply With Quote
  #2 (permalink)  
Old December 3rd, 2003, 05:32 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You're missing the dollar signs in front of your variable names (HTTP_POST_VARS)

Also, you should replace all instances of HTTP_xxx_VARS with their $_xxx counterparts:

$HTTP_POST_VARS => $_POST
$HTTP_GET_VARS => $_GET
  etc... for COOKIE, SESSION, ENV, SERVER


http://www.php.net/variables.predefined
http://www.php.net/reserved.variables

Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #3 (permalink)  
Old December 4th, 2003, 01:09 AM
Registered User
 
Join Date: Dec 2003
Location: Salt Lake City, UT, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, Nik! I typed in the update record parameters from the screenshot on p. 155 which doesn't have the $ in front of the variables. In the text the author does include the $, though.

I did not delete the $HTTP_ in front of my variables however. The page seems to be working just fine with them included. In fact, all the php files from Ch. 6 are working beautifully.

Now I'm going to really work on PHP basics -- Dreamweaver is ok but it seems to write buggy code lots of times.

Karen

Reply With Quote
  #4 (permalink)  
Old December 4th, 2003, 01:07 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I highly recommend you DO change $HTTP_xxxx_VARS to $_xxxx -- the old style variables ($HTTP_xxx_VARS) have been deprecated since PHP version 4.1.0, having been replaced by the $_xxxx versions.

By explicitly keeping the old-style variables in your code, you run the risk of having your code NOT work on future versions of PHP. PHP5 is just around the corner, and while the first versions might still support HTTP_xxx_VARS, the PHP guys aren't required to continue supporting it.


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #5 (permalink)  
Old August 20th, 2004, 02:55 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i cannot get Chapter 6 code to work, regardless of what I do. Do you have the code, please, so I can reference mine. I'm using php 4.3.8 + am totally stuck. Help!!!!!!!

Reply With Quote
  #6 (permalink)  
Old August 23rd, 2004, 09:48 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nicolai,
I agree we should use the later style variables.
However we cant get the code working from the book with either version.

On page 203 the author says
"In the newest versions of PHP, 4.1 and above, these arrays have been deprecated in favor of the following arrays $_POST and $_GET. However, this syntax is not available on servers with older versions of the PHP scripting engine - SO WE WONT USE IT"

Can you help us contact the authors to advise us in this forum?

Regards



RinseBouy
Reply With Quote
Reply


Thread Tools
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
PHP Parse error: parse error, unexpected T_STRING geminient PHP How-To 4 August 18th, 2007 03:27 AM
parse error $end pag 118 table3.php vkranendonk BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 February 2nd, 2006 12:05 PM
php parse error ajit_kunte BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 May 2nd, 2005 08:24 AM
MySQL & PHP Parse error Stuart BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 March 17th, 2005 03:44 PM



All times are GMT -4. The time now is 12:41 PM.


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