Jump to content
Larry Ullman's Book Forums

rob

Members
  • Posts

    143
  • Joined

  • Last visited

  • Days Won

    16

Posts posted by rob

  1. Yes, scope issues.

     

    mysqli_real_escape_string requires the database connection, so you'll either need to pass the connection into the function or make $dbc global.

     

    As it stands you're not returning any values ($errors, $input_name) so they are not accessible outside of the function. Again you could make $errors global and return the sanitized value if $input_name triggers else in your empty conditional.

    • Upvote 1
  2. Because that removes the flexibility of being able to pass in a filename as a function parameter and will only ever point to the script executing it.

     

    The login.php script redirects to loggedin.php, on successful validation of submitted user details, by setting:

     

    $url = absolute_url('loggedin.php');

    header("location: $url");

     

    The HTTP spec requires location headers to be absolute urls.

    • Upvote 1
  3. If you pass a custom variable to paypal it should be included when it sends information to your ipn script.

     

    I would start by dumping all the information being sent to your ipn script into a text file to see exactly what you're getting from paypal - I'm guessing you checked your logs already and nothing is showing?

     

    Could be an issue with how you're setting and sending the value to paypal. If it is being sent and is correct, then it's an issue with your ipn script - I'd start with mysql query debugging.

     

    You don't mention how you're storing the shopping cart information - I don't have the book to hand and cannot remember how that example in the book does it. If it's in a database, there's nothing in your script to remove it.

  4. I'd alternate css class names and set different background images in each:

     

    $class = ($class=='blue' ? 'green' : 'blue');
    echo '<tag class="' . $class . '">';
    

     

    You can't set a background image using an <img> tag, you need to set it in your css:

     

    .blue {
     background: url(path_to_image) 0 0 repeat;
    }
    

    Antonio's method is good, unless you have to support IE8,7. You could also achieve the same effect using javascript.

    • Upvote 1
  5. Your season object constructor is expecting 2 parameters $id and $season.

     

    The fetch_object method takes a second (when using OOP style) parameter for the object constructor:

     

    object mysqli_result::fetch_object ([ string $class_name [, array $params ]] )

     

    However, you don't really need to set id and season through a constructor in your season object, they'll be set as object properties anyway.

  6. Just to clarify there are two input attributes being discussed here: size & max-length.

     

    Size sets the visual width of the input and absolutely should be styled using CSS (keep markup and styling separate).

     

    Max-length determines the maximum number of characters that can be entered by the user. Max-length cannot be set using CSS.

     

    Interestingly, the new HTML5 specs have included a new attribute called pattern which allows you to set rules via a regular expression; I wonder over time if max-length will be deprecated and you'll have to test maximum input length against a PCRE.

     

    I would strongly advise the use of <label> instead of <b> around, well labels; that's what it's for (huge usability advantage too).

     

    I don't know which page you were referencing on w3schools; but, I've found a number of errors on their website in the past. I go to the specs or books now.

×
×
  • Create New...