Solved

How to display the select result at the same page ?

Posted on 2002-05-18
4
195 Views
Last Modified: 2008-03-10
Hi,

I'm now doing a searching program, and I wish to display the search result at the same page where the searching keyword is on top and the result result is at the bottom of the page. What is the best way of doing it ?? Please provide me some sample code. Thanks..
p/s : Is it possible to do it without using frame ??
0
Comment
Question by:suelow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
lokeshv earned 100 total points
ID: 7019290
of course its possible...

check this ..it will give u idea how to do it..
//my form
<html>
<body>
<form method=post action=<?=$PHPSELF?>>
<input type=text name=search_me><br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>

//now to display the results...
<?
if($submit){
echo "You searched for ".$HTTP_POST_VARS[search_me];
}
?>

Hope this helps..

Lk



0
 

Author Comment

by:suelow
ID: 7021097
Hi lokeshv,

I have tried the following code .. but there is an error
"Parse error: parse error in /usr/local/apache/htdocs/optics/TEST.PHP on line 54"

and I dun know why how to fix the error. Coz I have check the code. It seems there is no syntax error.. pls advice.


Code:
-----------------
<html>
<head>
<title>Testing</title>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="<?php echo $PHP_SELF?>">
  <p>From Supplier :
    <input type="text" name="fromSupp">
    To Supplier :
    <input type="text" name="toSupp">
  </p>
  <p>From Nd :
    <input type="text" name="fromNd">
    To Nd :
    <input type="text" name="toNd">
  </p>
  <p>From Vd :
    <input type="text" name="fromVd">
    To Vd:
    <input type="text" name="toVd">
    <input type="submit" name="submit" value="Submit">
  </p>
</form>

<?php

if($submit)
{
$db = mysql_connect("localhost", "root", "");
mysql_select_db("Optics", $db);

$result=mysql_query("select * from Glass where supplier >='$fromSupp' and supplier <='$toSupp' and nd >= $fromNd and nd <= $toNd and vd >= $fromVd and vd <= $toVd");
$myrow=mysql_num_rows($result);
if ($myrow=mysql_fetch_array($result)){
   echo "<table width 100% style=font-size:11; font-family:arial><tr BGCOLOR=#8099E6>
<td width=8%><div align=center><b><font color=#ffffff>Glass Type</font></b></div></td>
<td width=10%><div align=center><b><font color=#ffffff>Desc</font></b></div></td>
<td width=8%><div align=center><b><font color=#ffffff>Suppplier</font></b></div></td>
<td width=8%><div align=center><b><font color=#ffffff>ND</font></b></div></td>
<td width=8%><div align=center><b><font color=#ffffff>VD</font></b></div></td></tr>";
        do {
          printf("<TR bgcolor=#f7f7f7><TD><div align=center>%s</div></TD><TD><div align=center>%s</div></TD><TD><div align=center>%s</div></TD><TD><div align=center>%.5f</div></TD><TD><div align=center>%.2f</div></TD></TR>\n",$myrow["glass"],$myrow["desp"],$myrow["supplier"],$myrow["nd"],$myrow["vd"]);          
          } while($myrow = mysql_fetch_array($result));
           echo "</table><br>";
}
 
?>

</body>
</html>

 
0
 
LVL 4

Expert Comment

by:lokeshv
ID: 7021108
one curly braces "}" is missing ..

add that bfore ur clossing PHP tah "?>"


Hope this helps..

Lk
0
 

Author Comment

by:suelow
ID: 7022829
HAHA..I got it... thanks !! :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question