473,609 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE9 and FF not displaying HTML code generated from PHP.

3 New Member
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 3233
zmbd
5,501 Recognized Expert Moderator Expert
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
bajaexplorer
3 New Member
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 Recognized Expert Moderator MVP
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
bajaexplorer
3 New Member
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 Recognized Expert Moderator MVP
I don't see in your code how the variables $country, $shipping_to_st ate_prov, and $state_prov is being populated.
Dec 3 '12 #6
zmbd
5,501 Recognized Expert Moderator Expert
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
sharpcoders
2 New Member
My be columns your are calling is not exists. check the columns carefully in table of the database.
Secondly try selected="selec ted" instead of selected
Dec 7 '12 #8

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

Similar topics

3
3749
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 access report. Is there some kind of control that I can embed into the report so that I can see that HTML? Thanks, Mike
5
7835
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 COM control (like Microsoft WebBrowser). For each description there is one HTML file and along description text, it contains links to related information. Clicking related information would for example open new form in application and display some...
1
1651
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 he does all the Html and code within one file. For example normally we create an ASP.net application we will have the choice of doing the design in the design view and the code in the code view. This was not the case, he did both in the same file...
0
761
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 transformation (in order to get it and be able to extract the user’s input)… I have been struggling with this for a few days and I can’t find a way to get a handle to the html code, any help or advice is very appreciated and welcome. Thanks.
2
1438
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 fectch data in HTML format. The data is rendered by the Data Repeater in Table format on webpage. is there any way i can get reder data of data repeater from itself? i
2
4151
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 which contains pic and description of each video. But when I see the source html code, I just can see the section is generated by javascript function.
3
5775
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 I'd like to do some basic validation on the credentials subbitted via the form, and if they pass then send the credentials via email and display the rest of the page (which will have links to download some promotional tunes from my friends record...
6
1997
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 tried to replace "\r\n" to <br/>, but the smart ASP helps me to translate <br/into &quot;&lt;br/&gt; , so the <br/is useless here.... How can I do
7
14504
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 too... sample string value from database: <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold"> Sales Contract </SPAN></P> <SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold">Paragraph...
2
3046
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. contactus.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
0
8109
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8035
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
6969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6034
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4002
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4059
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2502
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.