usadarts
Members-
Posts
64 -
Joined
-
Last visited
Never
Everything posted by usadarts
-
I have the following in the header: [code]function categoryHandler(form){ var URL = "http://www.Example.com/index.php?"+category.site.value+"=Y"; window.location.href = URL; }[/code] The following form in the body: [code] <form name="category"> <div align="center"> <select name="site" size=1 onChange="javascript:categoryHandler()"> <option value=" ">Filter By Category</option> <option value="opt1">Option 1</option> <option value="opt2">Option 2</option> <option value="opt3">Option 3</option> <option value="opt4">Option 4</option> <option value="opt5">Option 5</option> <option value="opt6">Option 6</option> </select> </div> </form> [/code] I then have several IfElse statements to bring up page: [code]if($category == 'opt1') { $query = "SELECT * FROM `links` WHERE `opt1` = 'Y' and `approved` = 'Y' ORDER BY `title`"; $result = mysql_query($query,$dbh) or die(mysql_error()); } elseif($category == 'opt2') { $query = "SELECT * FROM `links` WHERE `opt2` = 'Y' and `approved` = 'Y' ORDER BY `title`"; $result = mysql_query($query,$dbh) or die(mysql_error()); } elseif($category == 'opt3') { $query = "SELECT * FROM `links` WHERE `opt3` = 'Y' and `approved` = 'Y' ORDER BY `title`"; $result = mysql_query($query,$dbh) or die(mysql_error()); } elseif($category == 'opt4') { $query = "SELECT * FROM `links` WHERE `opt4` = 'Y' and `approved` = 'Y' ORDER BY `title`"; $result = mysql_query($query,$dbh) or die(mysql_error()); } elseif($category == 'opt5') { $query = "SELECT * FROM `links` WHERE `opt5` = 'Y' and `approved` = 'Y' ORDER BY `title`"; $result = mysql_query($query,$dbh) or die(mysql_error()); } elseif($category == 'opt6') { $query = "SELECT * FROM `links` WHERE `opt6` = 'Y' and `approved` = 'Y' ORDER BY `title`"; $result = mysql_query($query,$dbh) or die(mysql_error()); }[/code] This does not work. It brings up the URL as: [code]http://www.dartsites.com/index.php?baseball=Y[/code] but does not filter the information as it should. It brings up everything in the database. Any ideas?
-
Is there a way to pass a range or >= or <= in the URL?
-
Thank you....however, I am now getting a different message..... Unknown column 'NJ' in 'where clause' [code]$queryt = "SELECT * FROM `affiliations` WHERE `state` = `$state` ORDER BY `org`";[/code] Never mind, got it.... $queryt = "SELECT * FROM `affiliations` WHERE `state` = '$state' ORDER BY `org`"; Thanks for all you help everyone, David
-
I got part of it to work. If I select ALL then works fine. If I select a certain state, I receive this error: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `state` = `NJ`' at line 1[/quote] Here is the particle code: [code] <script LANGUAGE="JavaScript"> function stateHandler(form){ var URL = "http://www.website.com/affiliations/index.php?state="+state.site.value; window.location.href = URL; } </SCRIPT> </HEAD> <body> <form name="state"> <select name="site" size=1 onChange="javascript:stateHandler()"> <option value="">Filter By State <option value="ALL">All States <option value="AL">Alabama <option value="AK">Alaska etc.......etc......etc...... </select> </form> </center> <table><tr><td> <?php $dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("Default_Database"); $state = $_GET['state']; if($state == 'ALL'){ $queryt = "SELECT * FROM `affiliations` ORDER BY `org`"; $resultt = mysql_query($queryt,$dbh) or die(mysql_error()); } else { $queryt = "SELECT * FROM `affiliations` ORDER BY `org` WHERE `state` = `$state`"; $resultt = mysql_query($queryt,$dbh) or die(mysql_error()); }[/code] Thanks, David
-
I see what I missed and understand it 100%. Thanks for the help. However, when selecting something from the pulldown menu, nothing happens. Not even an error of somekind. Thanks, David
-
Excellent....thanks everyone.....
-
When page is first loaded, I would like all the infomation within the database shown. Then I would like to have a pull down menu to allow the user to filter by a specific field. Here is what I have that does not work: [code]<HTML> <HEAD> <script LANGUAGE="JavaScript"> <!-- Begin function stateHandler(form){ var URL = http://www.anywebsite.com; window.location.href = URL; } // End --> </SCRIPT> </HEAD> <body bgcolor="#FFFFFF"> <form name="state"> <select name="state" size=1 onChange="javascript:stateHandler()"> <option value="">Filter By State <option value="AL">Alabama <option value="AK">Alaska <option value="AZ">Arizona <option value="AR">Arkansas </select> </form>[/code] Below this code is the following PHP code: [code]if($state == ''){ $queryt = "SELECT * FROM `affiliations` ORDER BY `org`"; $resultt = mysql_query($queryt,$dbh) or die(mysql_error()); } else { $queryt = "SELECT * FROM `affiliations` ORDER BY `org` WHERE `state` = $state"; $resultt = mysql_query($queryt,$dbh) or die(mysql_error()); }[/code] I was thinking that when a menu item is selected, the page will refresh itself with the correct filtered information. Thanks, David
-
What I need to do is the following: Someone enters in a ZIP code and I bring up a list of the 5 closest league in the country to that ZIP code. Is this possible with php or any other programming or is their software that needs to be bought? Thanks, David
-
Changed code to: [code] if($row['approved']= "Y"){ $adosanctioned = '<img src="/pictures/approved.jpg">' }[/code] Now getting this error: Parse error: parse error, unexpected '}' in /public_html/tournaments/calendar/test2.php on line 71
-
Hello all, [code] if($row['approved']= "Y"){ $sanctioned = "<img src="/pictures/approved.jpg">" } [/code] Receiving the following error: Parse error: parse error, unexpected T_STRING in public_html/tournaments/calendar/test2.php on line 70 Thanks, David
-
Found the problem...MidPhase does not allow the Mail Function as a default. They had to change the status to allow. Anyway, a quick question...how do I add second email address or a CC: address? Thanks David
-
Still does not work. [code]<?php $teamname = $_POST['teamname']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $coach = $_POST['coach']; $phone = $_POST['phone']; $email = $_POST['email']; $ym = $_POST['ym']; $yl = $_POST['yl']; $as = $_POST['as']; $am = $_POST['am']; $al = $_POST['al']; $xl = $_POST['xl']; $xxl = $_POST['xxl']; $xxxl = $_POST['xxxl']; $quantity = $_POST['quantity']; $subtotal = $_POST['subtotal']; $qtydisc = $_POST['qtydisc']; $grandtot = $_POST['grandtot']; $sender = "Webmaster@USADarts.com"; mail("$email", "Beach Blast T-Shirt Purchase Order Confirmation", " Order Confirmation: $teamname coached by $coach $address $city, $state $zip $phone $email $ym - Youth Medium 10-12 $yl - Youth Large 14-16 $as - Adult Small 34-36 $am - Adult Medium 38-40 $al - Adult Large 42-44 $xl - Adult XL 46-48 $xxl - Adult 2XL 50-52 $xxxl - Adult 3XL 54-56 Total Quantity Ordered: $quantity Sub Total: $subtotal Quantity Discount: $qtydisc Grand Total: $grandtot ", "From: $sender"); ?>[/code]
-
Any ideas? [code]<?php $teamname = $_POST['teamname']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $coach = $_POST['coach']; $phone = $_POST['phone']; $email = $_POST['email']."; DavidH@outerstuff.com"; $ym = $_POST['ym']; $yl = $_POST['yl']; $as = $_POST['as']; $am = $_POST['am']; $al = $_POST['al']; $xl = $_POST['xl']; $xxl = $_POST['xxl']; $xxxl = $_POST['xxxl']; $quantity = $_POST['quantity']; $subtotal = $_POST['subtotal']; $qtydisc = $_POST['qtydisc']; $grandtot = $_POST['grandtot']; $sender = "Beach Blast T-Shirts"; mail($email, "Beach Blast T-Shrt Purchase Order Confirmation", " Order Confirmation: $teamname coached by $coach $address $city, $state $zip $phone $email $ym - Youth Medium (10-12) $yl - Youth Large (14-16) $as - Adult Small (34-36) $am - Adult Medium (38-40) $al - Adult Large (42-44) $xl - Adult XL (46-48) $xxl - Adult 2XL (50-52) $xxxl - Adult 3XL (54-56) Total Quantity Ordered: $quantity Sub Total: $subtotal Quantity Discount: $qtydisc Grand Total: $grandtot ", "From: $sender"); ?>[/code]
-
The code below looks simple enough to me, but emails are not being received. [code] <?php $teamname = $_POST['teamname']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $coach = $_POST['coach']; $phone = $_POST['phone']; $email = $_POST['email']; $ym = $_POST['ym']; $yl = $_POST['yl']; $as = $_POST['as']; $am = $_POST['am']; $al = $_POST['al']; $xl = $_POST['xl']; $xxl = $_POST['xxl']; $xxxl = $_POST['xxxl']; $quantity = $_POST['quantity']; $subtotal = $_POST['subtotal']; $qtydisc = $_POST['qtydisc']; $grandtot = $_POST['grandtot']; $sender = "Beach Blast T-Shirts"; mail("$email; David@USADarts.com", "Beach Blast T-Shrt Purchase Order Confirmation", " Order Confirmation: $teamname coached by $coach $address $city, $state $zip $phone $email $ym - Youth Medium (10-12) $yl - Youth Large (14-16) $as - Adult Small (34-36) $am - Adult Medium (38-40) $al - Adult Large (42-44) $xl - Adult XL (46-48) $xxl - Adult 2XL (50-52) $xxxl - Adult 3XL (54-56) Total Quantity Ordered: $quantity Sub Total: $subtotal Quantity Discount: $qtydisc Grand Total: $grandtot ", "From: $sender"); ?>[/code] Thanks, David