Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7635493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:26:25+00:00 2026-05-31T07:26:25+00:00

I have a php based web app that on a user entering a value,

  • 0

I have a php based web app that on a user entering a value, it pulls the details from the mysql database and displays it without the page being refreshed. This is obviously done with javascript.

This works 100% correctly on internet explorer, chrome etc. from mobile devices such as blackberries and tablets the formatting is messed up once the user enters data. see screen shots below.

Internet explorer, table structure remains in tacts:
enter image description here

Mobile Device (Galaxy Tablet), table structure is changed:
enter image description here

example can be viewed here

The Code for the 2 pages involved is shown below. the front end is a php page which used javascript to fetch and display data from mysql.

php page:

<html>
<head>
<title>test</title>
<script type="text/javascript"> 
  function showUser(userNumber, str) 
  { 
  document.getElementById("r"+(userNumber)).style.display="block";  
    if (str=="") 
    { 
      document.getElementById("txtHint1").innerHTML=""; 
      return; 
    }   
    if (window.XMLHttpRequest) 
    {// code for IE7+, Firefox, Chrome, Opera, Safari 
      xmlhttp=new XMLHttpRequest(); 
    } 
    else 
    {// code for IE6, IE5 
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    } 

    xmlhttp.onreadystatechange=function() 
    { 
      if (xmlhttp.readyState==4 && xmlhttp.status==200) 
      { 
        document.getElementById("txtHint1").innerHTML=xmlhttp.responseText; 
      } 
    } 
    xmlhttp.open("GET","getdata1.php?q="+str,true); 
    xmlhttp.send(); 
  } 
</script> 
</head>
<body>

<form name="orderform" id="orderform" action="newsale.php" method="post">

<div align="left" id="txtHint1">mysql data will be shown here</div>
<br>
<table border="1">

    <tr id="r1">  
        <td>
            <input size="8"  type="text" id="sku1" name="sku1" onchange="showUser(1, this.value)" >
        </td>
        <td>
            <input  type="text" id="qty1" name="qty1" size="3">
        </td>
    </tr>
    <tr id="r2">  
        <td>
            <input size="8"  type="text" id="sku2" name="sku2" onchange="showUser(1, this.value)" >
        </td>
        <td>
            <input  type="text" id="qty2" name="qty2" size="3" >
        </td>
    </tr>
</table>

</form>
</body>
</html>

getdata1.php page to fetch mysql data:

<?php
 $q=$_GET["q"];

$con = mysql_connect('localhost', 'user', 'pass');
 if (!$con)
   {
   die('Could not connect: ' . mysql_error());
   }

mysql_select_db("database", $con);

$sql="SELECT Category, Description,SellingUnits,Grouping,CasesPerPallet,ShrinksPerPallet FROM skudata WHERE packcode = '".$q."'";

$result = mysql_query($sql);


while($row = mysql_fetch_array($result))
   {
   echo "<font color=blue size=2>Description:</font> <font color=red size=2>".$row['Description']."</font>, ";
   }

mysql_close($con);
 ?> 

Thanks again for all the asistance, it is appreciated.

Alternatively, does anybody have another javascript they can give me to dispaly the data from mysql? apologies but my javascript skills are non existant.

Thanks and Regards,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:26:27+00:00Added an answer on May 31, 2026 at 7:26 am

    The problem is in the first line of your JavaScript:

    document.getElementById("r"+(userNumber)).style.display="block";
    

    You’re setting the display style of the first table row to block. I don’t think there’s a reason to do that in your case, so just remove the line and your HTML will work nicely in all browsers, including the Samsung Galaxy Tab (I tested this on an actual tablet).

    As a side note, the cell shifting effect also happened in FireFox (and not anymore).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP-based web app that I'm trying to apply Apache's mod_rewrite to.
I have a small mySQL database and a few simple php based webpages that
I'm working on a class-based php web app. I have some places where objects
I have a PHP script that creates other PHP files based on user input.
I have different php output in jQuery-based tabs. This output is formed from database
I'd like to have a page in php that normally displays information based on
I'm working on a PHP-based webapp that has an existing MySQL database where all
I have an existing web app that allows users to rate items based on
I'm creating quick web app that needs to send a php-created message from within
I have a complex input form within a PHP based web application. To structure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.