There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Simple Search Form


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
turnbuk's Avatar
Computer Specs
Junior Member with 11 posts.
 
Join Date: Apr 2007
Experience: Intermediate
20-Jun-2008, 10:14 AM #1
Solved: Simple Search Form
I have a database with a moderate number of facilities and their respective information i.e. facilty number, address, operatinn hours. I'd like to create a simple search form webpage that would allow me to type in the facility number and that facility and information would appear right below where i inputted the search parameters, and nothing else. Anybody have any suggestions on how i could get this started? Thanks.
Mr.LLB's Avatar
Senior Member with 138 posts.
 
Join Date: May 2008
20-Jun-2008, 10:47 AM #2
If you are familiar with php, then this is quite easy.

look at this:

$search = mysqlquery("SELECT * FROM TABLE WHERE FACILITY_NUMBER LIKE '%$facility_number%'");

this would give you results of identical facility numbers based on what you feed the $facility_number variable.

if you want me to do the entire script then please post again
turnbuk's Avatar
Computer Specs
Junior Member with 11 posts.
 
Join Date: Apr 2007
Experience: Intermediate
20-Jun-2008, 10:50 AM #3
I'm not familiar with PHP so if its not too much trouble I'd appreciate it if you could write the script.
Mr.LLB's Avatar
Senior Member with 138 posts.
 
Join Date: May 2008
20-Jun-2008, 10:59 AM #4
THE FORM:

HTML Code:
<!-- This is where you enter the facility number which you want to search --> <form method='POST' action='search_results.php'> <input type='text' name='search' size='40' > <input type='submit' value='Search'> </form> 

THE PHP CODE....FILE NAME......search_results.php

PHP Code:
<?php
$f_num 
$_POST['search'];
//enter your database information
$db_connection mysql_connect("HOST NAME","USERNAME","PASSWORD");
mysql_select_db("DATABASE NAME THAT YOUR INFORMATION IS IN"$db_connection);
$results mysql_query("SELECT * FROM YOUR_TABLE_NAME WHERE FACILITY_NUMBER LIKE '%$f_num%' ");
while(
$row=mysql_fetch_array($results)) {
 
 echo 
$row['THE INFORMATION YOU WANT TO RETRIVE BASED ON YOUR FACILITY NUMBER'];
 
}
?>
Mr.LLB's Avatar
Senior Member with 138 posts.
 
Join Date: May 2008
20-Jun-2008, 11:00 AM #5
youll have to change some values as for host name, password, username, database name...etc.

YOUR_TABLE_NAME WHERE FACILITY_NUMBER LIKE = the column in which you have stored your facility numbers in the database.
Reply

Tags
form, search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:29 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.