Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Secure Search 1

Status
Not open for further replies.

LTeeple

Programmer
Aug 21, 2002
362
CA
Hi all you experts out there! I am on a quest for knowledge, here's my problem:

I wish to create a page in notes (*.nsf) in which the user will enter search data (first name, last name).
The submittal will call a php function which will handle the search - searching a maximizer database.

I would like the php function to live outside the search pages, so the form action will invoke a completely independent program, passing the search data as variables.

Could someone please point me in the direction to find out more information how to do this? Or even some tips/hints to get started. Greatly appreciated!

[flowerface]
Cheers!
Laura
 
Hi Laura

so you what the forms page to be html, to submitted to a php script, and then have another page show the results?

html page (search.html)
<html><body><form action=&quot;search.php&quot; method=post>
search for firstname:<input name=firstname type=text size=15>
search for lastname:<input type=text name=lastname size=15>
<input type=submit value=&quot;search></form></body></html>

search.php

<?
[red]//db connection info either thru require or in this file
//you can set this up[/red]
$sql=&quot;select * from mytable where firstname like '%&quot;.$_POST['firstname'].&quot;%' and lastname like '%&quot;.$_POST['lastname'].&quot;%'&quot;;

$result=mysql_query($sql) or die(&quot;Can't query&quot;);
if (!$result){ [red]//no results...[/red]
echo &quot;no results returned. try again&quot;;
[red]//pass the user back to the search page[/red]
header(&quot;location: exit;
}else{ [red]//there are results[/red]
echo &quot;<table><th>first name</th><th>last name</th>&quot;;
while ($rows=mysql_fetch_array($result)){
[red]//the two lines below are not really needed... included for
//clarity in displaying the results[/red]
$firstname = $rows['firstname'];
$lastname = $rows['lastname'];

echo &quot;<tr><td>$firstname</td><td>$lastname</td></tr>&quot;;
} [red]//end of display loop[/red]
echo &quot;</table>&quot;;
} [red]//end of if then statement[/red]
?>

is this the type of thing that you are after?
Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Hi Bastien,
Thanks for your speedy reply!

[cheers]
Cheers!
Laura
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top