| | |
search and results question.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2006
Posts: 35
Reputation:
Solved Threads: 1
hello all! i am writing a piece of a wedding website in php. this piece of the website is called a bridal registry. when a couple gets married, they tell people that they are registered at my website. this means that the couple came to my website and told them what they wanted people to purchase on their behalf. for example, a newlywed couple (The Smiths) come to me and say they want product1, product2 and product3 as their wedding gifts. friends of the newlyweds can conduct a search on my website for the newlyweds, then click THEIR 'registry', and they will be forwarded to a page with the products that the newlywed couple wants for their wedding gifts. if the couple wants many of product1, it will show how many they want (TOTAL), and how many they still need (purchased - TOTAL). each product can be purchased by anybody that views that newlywed's registry.
so, basically we have 3 pages. search page. results page. registry page. search has a few input fields, only one input field is required to have content. the results page returns the results of the search query. this will be laid out in a table. with each result there will be a link to 'view registry' for each newlywed couple(s) that the search query returned. when somebody clicks 'view registry', they will be taken to THAT couple's registry where all the products they wanted for wedding gifts will be shown. each product will have an 'add to cart' option, when clicked will take them to my 3rd party shopping cart.
here's what i got so far
i'm sure you'll see some problems with it already. it is being edited as we speak. however, i'm not certain how to keep all the search input data in an array. and then use all the search criteria in results.php to be outputted in a table the way you see above.
registry.php will probably just be a template page, and depending on the variable passed to registry.php, it will show the registry of the newlywed couple that they wanted to see. i figure this could be an $ID variable or something like that, affiliated with each newlywed couple in the database. i'm sure i'd use the $_POST method, but where? how? can anybody shed at least a LITTLE light on this issue? thanks in advanced.
so, basically we have 3 pages. search page. results page. registry page. search has a few input fields, only one input field is required to have content. the results page returns the results of the search query. this will be laid out in a table. with each result there will be a link to 'view registry' for each newlywed couple(s) that the search query returned. when somebody clicks 'view registry', they will be taken to THAT couple's registry where all the products they wanted for wedding gifts will be shown. each product will have an 'add to cart' option, when clicked will take them to my 3rd party shopping cart.
here's what i got so far
php Syntax (Toggle Plain Text)
<!-- SEARCH.PHP --> <form method="POST" action="results.php"> First Name:<input type="text" name="fname"><BR> Last Name:<input type="text" name="lname"><FONT COLOR="FF0000" SIZE="-1">(required)</FONT><BR> <SELECT NAME="regDate"> <OPTION VALUE="">Select an Event Date <OPTION VALUE="">Month | Year <OPTION VALUE="">Month | Year <OPTION VALUE="">Month | Year <OPTION VALUE="">Month | Year <OPTION VALUE="">Month | Year </SELECT> <BR> <input type="SUBMIT" value="Search!"> </form>
php Syntax (Toggle Plain Text)
<!-- RESULTS.PHP --> <?php trim($lname); if (!$lname) { echo "<FONT COLOR="FF0000">You have not filled the required fields. Please try again.</FONT>"; exit; } @ $db = mysql_pconnect("host", "name", "pass"); if(!$db) { echo "Error: Could not connect to the database. Please try again later."; exit; } mysql_select_db("registryDB"); $sql = mysql_query("SELECT * FROM regTable WHERE ". $lname ." LIKE '%". $lname ."%'") or die (mysql_error()); $result = mysql_query($sql); $num_result = mysql_num_rows($result); echo "Number of matches: ". $num_result "<br />"; do { echo "<TABLE BORDER="1"><TR><TH>Bride</TH><TH>Groom</TH><TH>Event Date</TH><TH> </TH></TR>"; } while(list($column1, $column2, $column3, $column4) = mysql_fetch_array($sql)) { for($i=0; $i < $num_result; $i++) { $row = mysql_fetch_array($result); echo "<TR><TD>". $row["brideName"] ." "</TD><TD>". $row["groomName"] ."</TD><TD>". $row["eventDate"] ."</TD><TD>". $row["viewReg"] ."</TD></TR><br />"; } echo "</TABLE>"; } ?>
i'm sure you'll see some problems with it already. it is being edited as we speak. however, i'm not certain how to keep all the search input data in an array. and then use all the search criteria in results.php to be outputted in a table the way you see above.
registry.php will probably just be a template page, and depending on the variable passed to registry.php, it will show the registry of the newlywed couple that they wanted to see. i figure this could be an $ID variable or something like that, affiliated with each newlywed couple in the database. i'm sure i'd use the $_POST method, but where? how? can anybody shed at least a LITTLE light on this issue? thanks in advanced.
Last edited by boo_lolly; Nov 13th, 2006 at 1:38 pm.
![]() |
Similar Threads
- TWERQ.com Tabbed search results. Start TWERQn! (Website Reviews)
- search results question (PHP)
- IE 6 Links & Search Results being Hijacked [HijackThisLog Included] (Viruses, Spyware and other Nasties)
- SQL search query (PHP)
- Domains With High Search Engine Results - New Domains Added (Websites for Sale)
- How Important is rundll32.exe? (Windows NT / 2000 / XP)
- We can't find "windowsupdate.microsoft.com" (MSN Search) (Viruses, Spyware and other Nasties)
- search and results problem (PHP)
Other Threads in the PHP Forum
- Previous Thread: Table issue
- Next Thread: phpmyadmin
| Thread Tools | Search this Thread |
301 access apache api array beginner binary broken cakephp checkbox class clean cms code compression countingeverycharactersfromastring crack cron curl database date decode directory display dissertation dropdown dynamic echo email error fairness file files folder form forms function functions google href htaccess html httppost image include insert integration ip javascript joomla limit link login mail match md5 menu methods mlm multiple mysql newsletters oop pageing pagerank paypal pdf php problem protocol query radio random recursion remote script search secure server sessions simple sms soap source space spam sql syntax system table tutorial update upload url validator variable video votedown web youtube





