Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts

    Anomaly showing up in HTML from PHP code

    I have a form set up (donations.php) that gathers information about a donor. When the user clicks on "Continue," it takes him from donations.php to confirm.php, and it POSTs the info. The confirm.php page puts the POSTed info into variables, prints them in a table and then provides two buttons. One button will submit the donation, and one will "Go Back" to the donations.php page, so they can edit the info if something is incorrect. For this "Go Back" button, I've set it up so that the POSTed variables are thrown into hidden fields and POSTed again back to the donations.php page when the user clicks on "Go Back." And then the values of the fields on the donations.php page are filled with the info that the user already entered, so he can correct it easily without having to enter it all again.

    My problem is that when the user then changes his info and clicks on "Continue" again, all of the sudden, this shows up in between the "Submit Donation" and the "Go Back" buttons on the confirm.php:

    Code:
    " />
    The weird thing is that this " /> does NOT show up in the "View Source" code. It does this in both IE7 and Firefox 1.5. Here is what the PHP code looks like for this portion:

    PHP Code:
    content .= '<input type="submit" name="submit_donation_button" value="Submit Donation"></form> ';
    include(
    'include/confirmation_error_form.php');
    $content .= $gobackbutton.'<br />'
    In the confirmation_error_form.php file, it has the hidden form fields that holds the user's info that will be passed back to the donation form, so he can easily edit it. Here's the code for that file:

    PHP Code:
    <?php

    $gobackbutton 
    .= '
    <div style="display: inline;">
    <form action="donations.php" method="POST"><input type="hidden" name="ecom_billto_postal_name_first" value="'
    .$first_name.'" /><input type="hidden" name="ecom_billto_postal_name_last" value="'.$last_name.'" /><input type="hidden" name="ecom_billto_postal_street_line1" value="'.$address.'" /><input type="hidden" name="ecom_billto_postal_street_line2" value="'.$echo_address2.'" /><input type="hidden" name="ecom_billto_postal_city" value="'.$city.'" /><input type="hidden" name="ecom_billto_postal_stateprov" value="'.$state.'" /><input type="hidden" name="ecom_billto_postal_postalcode" value="'.$zipcode.'" /><input type="hidden" name="ecom_billto_telecom_phone_number" value="'.$phone_number.'" /><input type="hidden" name="ecom_billto_online_email" value="'.$email.'" /><input type="hidden" name="ecom_payment_card_type" value="'.$card_type.'" /><input type="hidden" name="ecom_payment_card_number" value="'.$card_number.'" /><input type="hidden" name="ecom_payment_card_expdate_month" value="'.$expDateMonth.'" /><input type="hidden" name="ecom_payment_card_expdate_year" value="'.$expDateYear.'" /><input type="hidden" name="ecom_payment_card_name" value="'.$name_on_card.'" /><input type="hidden" name="ecom_payment_card_verification" value="'.$ccv.'" /><input type="hidden" name="pg_total_amount" value="'.$amount.'" />';

    // put frequency variable back into text
        
    if ($frequency == '') {
            
    $frequency "One Time";
        } elseif (
    $frequency == "20") {
            
    $frequency "Monthly";
        } elseif (
    $frequency == "30") {
            
    $frequency "Quarterly";
        } elseif (
    $frequency == "40") {
            
    $frequency "Yearly";
        }
        
            
    $gobackbutton .= '<input type="hidden" name="frequency" value="'.$frequency.'" /><input type="hidden" name="pg_consumer_id" value="'.$chapter_name.'" /><input type="hidden" name="domain" value="'.$domain.'" /><input type="submit" name="goback" value="Go Back" /></form>
    </div>
    '
    ;
    ?>
    See the attached jpg's to see what this anomaly looks like. Please let me know if you have any idea why it is doing this. I'm stumped. Thanks.
    Attached Thumbnails Attached Thumbnails Anomaly showing up in HTML from PHP code-before.jpg   Anomaly showing up in HTML from PHP code-after.jpg  
    Last edited by JohnDubya; 12-21-2006 at 09:35 PM.

  • #2
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Wow, after diving head first into my code once again, I finally fixed it.

    When the user info went from confirm.php back to the donations.php page, it was checking to see if the $address2 variable was NULL. I had set $address2 to be "&nbsp;" in the code, so when it checked $address2 to be NULL, it was false, and that is what created the problem. Very strange and not predictable at all (at least to me).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •