Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 June 23rd, 2004, 06:23 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 15 problems

I just wanted to alert everyone that useraccount.php has a problem. The code forgets to include the email field in the form when you are trying to create a new account which will prevent you from creating an account which leads me to another problem/suggestion in the code in this case on the user-transact.php. When creating an account it just verifies it has all the necessary information to do it, if it doesn't without any error message alerting you of missing information(in this case the email since there was no field to type it in) it redirects to the index.php.

I have fixed the code of useraccount.php to include the email when creating an account. These are the changes you need to make:

right before the line where it says: if ($mode == "Edit"){ add (a closing brace) }.
Then right before what it should now read:
"?php
    }
  if ($mode == "Edit") { " add
"?php
 if ($mode == "Create") {
?>
<p>
  Email Address:<br />
  <input type="text" class="txtinput" name="email" maxlength="255"
    value="" />
</p>"
After this changes I could create accounts and thefore continue reading the book.
One more thing, I think Buzzly was the one who wrote this chapter which by the way buzzly I think is the best chapter so far, if you have the time could you confirm that my changes are correct otherwise what are the corrections that need to be made.

Thanks
Christian

__________________
Christian
 
Old June 28th, 2004, 05:07 PM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are half correct. First, there is no missing bracket. You'll find the correct closing bracket on line 25 of the code. However, you are correct about missing the email during creation. I had actually corrected it, but for some reason the fixed code didn't make it into the book. I apologize for the error.

Modify line 37:
Code:
if ($mode == "Edit") {
to read:
Code:
if ($mode == "Edit" || $mode == "Create") {
and it should work like a charm.

Yes, I did write Chapter 15, and thank you. Let me know if this change helps you.

Michael K. Glass
Author, Beginning PHP, Apache, MySQL Web Development
 
Old July 8th, 2004, 11:38 AM
Registered User
 
Join Date: Jun 2003
Location: Cincinnati, OH, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On the "transact-user.php" page, in the "Modify Account" case (lines 68-79), no "email" data is being sent from the previous page. As a result, the commented lines below are not necessary and must be removed from the code to be able to perform the sql update.

    case 'Modify Account':
      if (isset($_POST['name'])

          //and isset($_POST['email'])

          and isset($_POST['accesslvl'])
          and isset($_POST['userid']))
      {
        $sql = "UPDATE forum_users " .
               "SET

               // email='" . $_POST['email'] . "',

               name='" . $_POST['name'] .
               "', access_lvl=" . $_POST['accesslvl'] .
               ", signature='" . $_POST['signature'] . "' " .
               " WHERE id=" . $_POST['userid'];

Hope this is clear. Let me know if there are any questions.


Bruce
 
Old July 8th, 2004, 01:12 PM
Authorized User
 
Join Date: Apr 2004
Location: Cincinnati, OH, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Bruce,
You might want to make sure that the variables in your code are not named $e-mail, or you're right- they won't work. This was a global problem that occurred in the publishing process (gotta love word processor's auto-correct feature, right?) :)

 
Old July 8th, 2004, 06:27 PM
Registered User
 
Join Date: Jun 2003
Location: Cincinnati, OH, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Elizabeth,
Fortunately, I was able to catch the "$e-mail" thing early on, but thanks! However, when I go through "useraccount.php", if $mode == "Modify", the code doesn't send a value for 'email'. Therefore, when "transact-user.php" sees that $_POST['email'] is empty in the 'Modify Account' case, it won't perform the UPDATE and simply redirects back to 'admin.php'. Don't mean to argue here. Us Cincinnati-folk gotta stick together :] Just want to make sure I'm reading the code correctly. Again, thanks. Nice to have the author(s) looking after us.
Bruce

Bruce
 
Old July 8th, 2004, 11:50 PM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are right, another solution is to leave transact-user.php as it is and add the line
Code:
echo '<input type="hidden" name="email" value="' . htmlspecialchars($useremail) . '">';
on useraccount.php after the line that says:
Code:
 if ($mode == "Modify")
Good catch. Thanks for posting it.

Christian




Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 15 - ciwluke BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 11th, 2008 03:33 PM
Problems in chapter 15 and 16 sgeorgiev BOOK: Ivor Horton's Beginning Visual C++ 2008 ISBN: 978-0-470-22590-5 0 May 7th, 2008 11:57 PM
chapter 15 manal_sag BOOK: Beginning ASP 3.0 1 June 18th, 2005 11:05 AM
Chapter 15 problems mweining BOOK: Beginning ASP 3.0 19 May 4th, 2005 05:27 PM
Chapter 15 Problems bmull BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 July 13th, 2004 01:22 PM





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