473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

IE9 and FF not displaying HTML code generated from PHP.

In both IE9 and FF.

I have two php routines in a web page. Both are alike except variables. Both will output the HTML <options> for <select> in both routines. Have verified the source at the browser for both. But the first one is not displaying.

The correct HTML code is in the browser and have saved it as a htm file. Running this file, the web page does display correctly, with the proper 'selected' option.

first one not working:

Expand|Select|Wrap|Line Numbers
  1. <tr>
  2.  <td align="left">State/Province
  3.   <span id="star">*</span>
  4.  </td>
  5.  <td align="left">
  6.  <div id="shipping_to_state_div" style="float:left">
  7.  <select id="shipping_to_state_prov" name="shipping_to_state_prov">
  8.  
  9. <?php
  10. $sql = "SELECT * FROM state WHERE country='".$country."'";
  11. $data_assoc_array = $db->getQuery($sql);
  12. $data_num_rows    = $db->num_rows;
  13. echo '<option value="">Select State_Prov</option>';
  14. for( $indx = 0; $indx < $data_num_rows; $indx++ )
  15. {
  16.   echo '<option value="'.$data_assoc_array[$indx]['ID'].'"';
  17.  
  18.   if( $data_assoc_array[$indx]['ID'] == $shipping_to_state_prov )
  19.   {
  20.     echo ' selected';
  21.   }
  22.   echo ' >'. $data_assoc_array[$indx]['title']. '</OPTION>'."\n";
  23. }
  24. ?>
  25. </SELECT>
  26. </div>
  27. </td>
  28. </tr>
  29.  
Second one working:
Expand|Select|Wrap|Line Numbers
  1. <tr>
  2. <td align="left">State/Province
  3.   <span id="star">*</span>
  4. </td>
  5. <td align="left">
  6. <div id="shipping_to_state_div" style="float:left">
  7. <select id="shipping_to_state_prov" name="shipping_to_state_prov">
  8. <?php
  9.  $sql = "SELECT * FROM state WHERE country='".$country."'";
  10.  $data_assoc_array = $db->getQuery($sql);
  11.  $data_num_rows    = $db->num_rows;
  12.  echo '<option value="">Select State_Prov</option>';
  13.  for( $indx = 0; $indx < $data_num_rows; $indx++ )
  14.  {
  15.    echo '<option value="'.$data_assoc_array[$indx]['ID'].'"';
  16.  
  17.    if( $data_assoc_array[$indx]['ID'] == $shipping_to_state_prov )
  18.    {
  19.      echo ' selected';
  20.    }
  21.    echo ' >'. $data_assoc_array[$indx]['title']. '</OPTION>'."\n";
  22.  }
  23. ?>
  24. </SELECT>
  25. </div>
  26. </td>
  27. </tr>
  28.  
Dec 2 '12 #1
7 3226
zmbd
5,501 Expert Mod 4TB
bajaexplorer:

And just what exactly is "not working" in the first code vs. the second block of code. What errors (if any)? What is it you want the code to do?
Dec 2 '12 #2
I thought I explained it very well.
Neither EI9 nor FF is displaying the HTML code generated by one of the PHP routine. There are two PHP routines, both alike except for the variables.

Looking at the source code in browser, the <select> <options> and 'selected' are there for both routines. But one of them is not display in the browser.

in other words:

Expand|Select|Wrap|Line Numbers
  1. <select id="state_prov" name="state_prov">
  2. <option value="">Select State_Prov</option>
  3. <option value="32" >Alabama</OPTION>
  4. <option value="73" >South Dakota</OPTION>
  5. <option value="74" selected >Tennessee</OPTION>
  6. <option value="75" >Texas</OPTION>
  7. </SELECT>
  8. <
None of it is being shown in one of the two fields in the browser.

Even tho this is what is in for browser source.
The web pages two columns only have one that is display the state 'Tennessee'.
Dec 2 '12 #3
Rabbit
12,516 Expert Mod 8TB
I thought you said they were mostly the same except for the variable names? But when I look at the two code samples you posted, the variables are the same as well. Are you sure you posted the right code?
Dec 3 '12 #4
Yes, I copied the wrong one. Forgive me for that.
But what gets me, is why is it in the browser as HTML correctly, but still will not display.
Like I had mentioned, if i save that source from the browser and click on the htm file of it. It pops up showing correctly.

If this was any other app, I would think I had a race condition.

Expand|Select|Wrap|Line Numbers
  1. <tr>
  2. <td align="left">State/Province:<span id="star">*</span></td>
  3. <td align="left">
  4. <div id="state_div" style="float:left">
  5. <select id="state_prov" name="state_prov">
  6. <?php
  7.    $sql = "SELECT * FROM state WHERE country='".$country."'";
  8.    $data_assoc_array = $db->getQuery($sql);
  9.    $data_num_rows    = $db->num_rows;
  10.    echo ' <option value="">Select State_Prov</option>';
  11.    for( $indx = 0; $indx < $data_num_rows; $indx++ )
  12.    {
  13.       echo '<option value="'.$data_assoc_array[$indx]['ID'].'"';
  14.  
  15.       if( $data_assoc_array[$indx]['ID'] == $state_prov )
  16.       {
  17.          echo ' selected';
  18.       }
  19.  
  20.       echo ' >'. $data_assoc_array[$indx] ['title']. '</OPTION>'."\n";
  21.    }
  22. ?>
  23. </SELECT>
  24. </div>
  25. </td>
  26. </tr>
  27.  
Dec 3 '12 #5
Rabbit
12,516 Expert Mod 8TB
I don't see in your code how the variables $country, $shipping_to_state_prov, and $state_prov is being populated.
Dec 3 '12 #6
zmbd
5,501 Expert Mod 4TB
bajaexplorer

And that is why I asked the question I did... HTML is not one of the languages I use often; thus, I thought I had missed something.
Dec 3 '12 #7
My be columns your are calling is not exists. check the columns carefully in table of the database.
Secondly try selected="selected" instead of selected
Dec 7 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike Turco | last post by:
I have an Access database that holds a catalog and one of the fields contains the HTML for the web page. The HTML code is very simple. I would like to be able to display that HTML output on an...
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
1
by: nesster13 | last post by:
Dear All, I am a new VB programmer and dont know very much about it so please bare with me. Here is the situation. My professor gave us an e-commerce website to work on but the problem is that...
0
by: juan_mauricio_lopez | last post by:
I built an html from a XML and a XSL transformation, now I need to parse the html in order to get the input form the user but I’m not being able to reference the HTML produced by the...
2
by: Lucky | last post by:
hi guys! i've got very interesting problem. it is like this. is it possible to get HTML generated by the server control in code behind? i'm developing an asp.net web application where i need to...
2
by: cttseng | last post by:
Dear all, I have a problem that how to get the page's source code which is generated by javascript code? For example: http://grouper.com/video/south%2bpark Although I can see the result page...
3
by: Doug (dtism) | last post by:
Hello **newbie alert** <-- that's me btw, but you might have guessed that by my topic title. I have an html page that submits a name and email address by a form to a page called preview.php ...
6
by: LamSoft | last post by:
I have a cell in the datagrid, which the original data is as following: Testing1 Testing2 Testing3 Testing4 There are 4 lines, while it displays on the browser, it shows as a line, and I...
7
by: Ned White | last post by:
Is it possible to insert HTML codes to a textbox control ? I am reading HTML formated string from sql server but if i assign this value to Text property of TextBox, the format tags of HTML seems...
2
by: sateeshchandrasanga | last post by:
Hi All, My HTML code is working fine in Firefox.But its not displaying any thing in IE.Can you help me in this problem.And in Google crown its displaying but not properly. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.