Jump to content

Display result from php code in new page - please help :)


xcali

Recommended Posts

Hello!

I have a quick question i would like to get some help with if possible:

For school project we are doing a web page for a modeling agency and one of the sections is "Browsing".

User either enters a name and hits search, or enters search criteria and hits search.

Now what i would like to do is have a new window pop out with those results - right now the page only 'jumps' to the results page - then i gotta hit back and refresh the page to be able to search again.

Here is the code i am using:

<?php
if ($_POST['searching'] == "yes")
{ echo '<h1 class="style2">Results</h1><p>';
$find = $_POST['find'];
$field = $_POST['field'];
if ($find == "")
{ echo '<h1 class="style2"><p>You forgot to enter a search term</h1>';
exit;
}
require_once ('../cgi-bin/dbconnect.php');

$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);
$data = mysql_query("SELECT * FROM users WHERE regis_as='M' and upper($field) LIKE'%$find%'");
while($result = mysql_fetch_array( $data ))
{ 
echo $result['first_name'];
echo " ";
echo $result['last_name'];
echo "  -  ";
echo $result['username'];
echo "  -  ";
echo $result['age'];
echo "  -  ";
echo $result['ethnicity'];
echo "<br>";
}
$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{ echo "Sorry, but we can not find an entry to match your query<br><br>"; }
}
?>

 

later on i'm gonna fix it and make the results display in a nice table with background and buttons and such

For now i just need it to open in a new window.

 

Noob question but please advise :P

its not like i'm asking someone to write out the whole for me or a script

just asking if theres an easy way to make the results appear on the new page

so far i can do it on the same page which is kind of nice - but it would look better if i had them displayed on a new page

but thanks for your answer

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.