473,387 Members | 1,493 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,387 software developers and data experts.

How to show the php result on the same page

Actually I want the result of php on the same page.It is code that i used(naip1.html)
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_POST['submit'])) 
  3. {
  4. $dbhost = "localhost";
  5. $dbuser = "root";
  6. $dbpass = "";
  7. $dbname = "purchase";
  8.     //Connect to MySQL Server
  9. mysql_connect($dbhost, $dbuser, $dbpass);
  10.     //Select Database
  11. mysql_select_db($dbname) or die(mysql_error());
  12.     // Retrieve data from Query String
  13.  
  14. $Fileno = $_GET['Fileno'];
  15.  
  16.  
  17. $query = "SELECT * FROM naiptwo WHERE Fileno LIKE '%$Fileno%'";
  18. $qry_result = mysql_query($query) or die(mysql_error());
  19.  
  20. print "<table width=200 border=1>\n"; 
  21.  
  22. print"\t<tr><th>Sanctionamt</th><th>
  23. Availableamt</th><th>Dateoffirstrelease</th><th>
  24. Amtoffirstrelease</th><th>Dateofsecondrelease</th><th>Amtofsecondrelease</th><th>Netamt</th><th>Fileno</th><th>fil
  25.  
  26. einitiation</th><th>nameofindenter</th><th>materialreceivedpurchasedandpaymentreleased
  27. </th><th>nameoffirm</th><th>completeaddressoffirm</th><th>head</th><th>subhead</th><th>sanctioneddate</th><th
  28.  
  29. >sanctionedamt</th><th>progressivebal</th><th>sanctionedbal</th><th>billdate</th><th>billamt</th><th>billbal</th><
  30.  
  31. th>percentage</th></tr>\n";
  32.  
  33. while ($get_info = mysql_fetch_row($qry_result)){ 
  34. print "<tr>\n"; 
  35. foreach ($get_info as $field) 
  36. print "\t<td><font face=arial size=2/>$field</font></td>\n"; 
  37. print "</tr>\n"; 
  38. print "</table>\n"; 
  39. }
  40. ?> 
  41.  
  42. <html>
  43. <body>
  44. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  45.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  46. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
  47. <head>
  48.     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  49.     <title>genome analysis lab</title>
  50. <link rel="stylesheet" type="text/css" media="screen" href="dbpage.css" />
  51. </head>
  52. <body>
  53.  
  54. <div id="container">
  55.     <div id="intro">
  56.         <div id="pageHeader">
  57.             <h1><span>Genome Analysis Lab</span></h1>
  58.             <h2><span>Purchase database</span></h2>
  59.         </div>
  60. <form method="GET" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
  61.  
  62. &nbsp;&nbsp;
  63. &nbsp;&nbsp;File no:<br/>
  64. &nbsp;&nbsp;
  65. &nbsp;&nbsp;<input type="varchar" name="Fileno" size="30"/><br/><br>
  66.  
  67. &nbsp;&nbsp;
  68. &nbsp;&nbsp; <input type="submit" name="submit" value="Submit">
  69. </form>
  70. <div id="linkList">
  71.         <div id="linkList2">
  72.             <div id="lselect">
  73.                 <ul>
  74.                     <li><a href="date2.html">2008-09</a></li>
  75.                     <li><a href="naipyr2.html">2009-10</a></li>
  76.                     <li><a href="naipyr3.html">2010-11</a></li>
  77.                     <li><a href="naipyr4.html">2011-12</a></li>
  78.                     <li><a href="naipyr5.html">2012-13</a></li>
  79.                 </ul>
  80.             </div>
  81.  
  82.  
  83.  
  84.  
  85.  
  86. </body>
  87. </html>
  88.  
  89.  
  90.  
Mar 19 '13 #1
3 4927
Rabbit
12,516 Expert Mod 8TB
You need to print out your results in the body of the document. Not at the very top.
Mar 19 '13 #2
thanx for reply.I do this but it show error you do not have permission to access the server.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_POST['submit'])) 
  3. {
  4. $dbhost = "localhost";
  5. $dbuser = "root";
  6. $dbpass = "";
  7. $dbname = "purchase";
  8.     //Connect to MySQL Server
  9. mysql_connect($dbhost, $dbuser, $dbpass);
  10.     //Select Database
  11. mysql_select_db($dbname) or die(mysql_error());
  12.     // Retrieve data from Query String
  13.  
  14. $Fileno = $_GET['Fileno'];
  15.  
  16.  
  17. $query = "SELECT * FROM naiptwo WHERE Fileno LIKE '%$Fileno%'";
  18. $qry_result = mysql_query($query) or die(mysql_error());
  19.  
  20. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  21.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  22. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
  23. <head>
  24.     <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  25.     <title>genome analysis lab</title>
  26. <link rel="stylesheet" type="text/css" media="screen" href="dbpage.css" />
  27. </head>
  28. <body>
  29.  
  30. <div id="container">
  31.     <div id="intro">
  32.         <div id="pageHeader">
  33.             <h1><span>Genome Analysis Lab</span></h1>
  34.             <h2><span>Purchase database</span></h2>
  35.         </div>
  36. <form method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  37.  
  38. &nbsp;&nbsp;
  39. &nbsp;&nbsp;File no:<br/>
  40. &nbsp;&nbsp;
  41. &nbsp;&nbsp;<input type="varchar" name="Fileno" size="30"/><br/><br>
  42. print "<table width=200 border=1>\n"; 
  43.  
  44. print"\t<tr><th>Sanctionamt</th><th>
  45. Availableamt</th><th>Dateoffirstrelease</th><th>
  46. Amtoffirstrelease</th><th>Dateofsecondrelease</th><th>Amtofsecondrelease</th><th>Netamt</th><th>Fileno</th><th>fil
  47.  
  48. einitiation</th><th>nameofindenter</th><th>materialreceivedpurchasedandpaymentreleased
  49. </th><th>nameoffirm</th><th>completeaddressoffirm</th><th>head</th><th>subhead</th><th>sanctioneddate</th><th
  50.  
  51. >sanctionedamt</th><th>progressivebal</th><th>sanctionedbal</th><th>billdate</th><th>billamt</th><th>billbal</th><
  52.  
  53. th>percentage</th></tr>\n";
  54.  
  55. while ($get_info = mysql_fetch_row($qry_result)){ 
  56. print "<tr>\n"; 
  57. foreach ($get_info as $field) 
  58. print "\t<td><font face=arial size=2/>$field</font></td>\n"; 
  59. print "</tr>\n"; 
  60. print "</table>\n"; 
  61. }
  62. ?> 
  63.  
  64. &nbsp;&nbsp;
  65. &nbsp;&nbsp; <input type="submit" name="submit" value="Submit">
  66. </form>
  67. <br>
  68. <div id="linkList">
  69.         <div id="linkList2">
  70.             <div id="lselect">
  71.                 <ul>
  72.                     <li><a href="date2.html">2008-09</a></li>
  73.                     <li><a href="naipyr2.html">2009-10</a></li>
  74.                     <li><a href="naipyr3.html">2010-11</a></li>
  75.                     <li><a href="naipyr4.html">2011-12</a></li>
  76.                     <li><a href="naipyr5.html">2012-13</a></li>
  77.                 </ul>
  78.             </div>
  79.  
  80.  
  81.  
  82.  
  83.  
  84. </body>
  85. </html>
  86.  
  87.  
  88.  
Mar 20 '13 #3
Rabbit
12,516 Expert Mod 8TB
Then you need to check your server settings and make sure you have it set up correctly. If you need further help diagnosing the permission issue, you will have to create a new thread for it as we only allow one question per thread and that is a different issue than your original question.
Mar 20 '13 #4

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

Similar topics

0
by: Matthew Louden | last post by:
I am new to crystal report. I have ASP.NET pages that show the search result. Since the search result is represented by datagrid, it will be nice to put a button on that page, and allows the user...
0
by: surendra.rajput | last post by:
hi all friends I want your help. I am working with HTML help Workshop ,In run time it show first page Blank(Default page) .How i can Set First Page of Help file . thank you surendra
1
by: vailayavenkatesh | last post by:
can any one tell me how to create an pdf file from the html page ? 1. I am querying the database. 2. The result is obtained in the file result.php 3. I want to give the user an option to save the...
5
by: David | last post by:
Hi, I have an asp page which prints data as follows: The sum in brackets is a calculated result on the page, SQ * RS2("SelectorQty"), a variable SQ which holds a qty multiplied by a record...
1
by: rajap | last post by:
How to write all the links of the google search result page into a text file using C#.
6
by: Yang | last post by:
I have a page with source code like this: <script type="text/javascript"> function displayResult(data) { } } </script> <script type="text/javascript" src="http://something.com/data?
5
by: skuer | last post by:
Hey people.. I'm trying to find out how i can click on a result page after a search, so it can show the result more detailed in new a page. Is this possible? All the user datas is stored in...
1
by: suchetapatra | last post by:
add two number and show result in another browser window. in javascript
1
by: dagmawi michael | last post by:
Hello Currently I am building a glossary website on local server which is going to have above 50,000 words. The words stored in the database must show right under the search bar alphabetically. The...
5
by: GLEberts | last post by:
I am trying to show a result in an additional text box on my form - from the last line in a continous form. (1) My main form - fmInvoice (2) My sub form - fmInvoiceSubform (3) Text box in...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.