Results 1 to 2 of 2

Thread: Web page contents different from View Source contents

  1. #1
    Join Date
    Sep 2012
    Posts
    27
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Web page contents different from View Source contents

    I have a PHP page that displays as wanted, without showing any error messages.

    When I View Source for this page I see PHP-generated error messages that do not display in the browser and are actually incorrect. For example, View source shows an error message "Undefined index 'score'" yet the value of "score" displays correctly. Another example is "Invalid argument supplied for foreach()", yet the foreach() loop executes correctly and shows the desired values.

    Below is the view source output. Another mystery is that the view source text shows no entries between the table body tags, but the expected values in the table are showing in the browser.

    The actual page as displayed in the browser is in the image here: http://estateagentsespana.com/quiz_fun.png. What is happening?

    Code:
    <div class="container-fluid" style="width:90%;">
    <div class="row">
    <div class="col-xs-12 col-9" > <!--First Grid row abd first grid column used to hold index cards-->
    <p><br />
    <b>Notice</b>:  Undefined index: score in <b>C:\xampp\htdocs\bootstrapestate\quizzer2\final.php</b> on line <b>27</b><br />
    Your score is: 				</p>
    
    <p><input type="submit" value = "Retake quiz" onclick="window.location.href = 'index.php?n=1&t=';"></p>
    <input type="button" id="reveal" value = "See answers" onclick="showanswers()"></p>
    <br />
    <b>Notice</b>:  Undefined index: performance in <b>C:\xampp\htdocs\bootstrapestate\quizzer2\final.php</b> on line <b>37</b><br />
    <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in <b>C:\xampp\htdocs\bootstrapestate\quizzer2\final.php</b> on line <b>37</b><br />
    <div id='ans'style='display:none;'><table class='table'>
        <thead>
          <tr>
            <th>Number</th>
            <th>Question</th>
            <th>Correct answer</th>
            <th>Your answer</th>
          </tr>
        </thead> <tbody>
          </tbody></table>	
    <div class="row">
    
    </div>
    </div>

  2. #2
    Join Date
    Sep 2012
    Posts
    27
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    I've worked out what's happening, but still do not know why View source differs from page display. PHP is generating errors because the page has a session_destroy command, so a page reload tries to use variables that no longer have values. The error messages are visible in View source, but are not being output to the displayed page.

Similar Threads

  1. Replies: 6
    Last Post: 03-27-2013, 10:55 PM
  2. view php contents
    By james438 in forum PHP
    Replies: 8
    Last Post: 09-20-2007, 04:11 PM
  3. 2 Ajax Tabs Contents on the same page (one inside of another)
    By viens in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 09-12-2007, 11:32 PM
  4. 1 Page & 2 different Contents
    By kobo1d in forum JavaScript
    Replies: 5
    Last Post: 07-16-2007, 03:27 PM
  5. Changing Layer contents causes page to jump
    By Daiv in forum JavaScript
    Replies: 2
    Last Post: 09-15-2006, 12:35 AM

Bookmarks

Posting Permissions

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