Jump to content

dhendler

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

About dhendler

  • Birthday 07/05/1981

Profile Information

  • Gender
    Female

dhendler's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That wasn't quite what I was looking for.
  2. This is driving me nuts. I'm trying to create 3 dynamic dependent dropdowns that are all populated from 3 different fields on the same mysql table. Their purpose is to sort a table of links to PDF files based on the criteria selected. (Select A + Select B + Select C + "Submit" = Displays list below) I haven't even gotten to the display links part of it, I can't seem to get the dropdowns work the way I want. Ideally, I would like them to be sticky and each have a static value of "all". I've posted the code (so far) below, but let me know if you have any questions. Thank you so much! Any help is appreciated <?php $username="root"; $password=""; $database="proposals"; $server="localhost"; $ID = 0; $con = mysql_connect($server,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $firstQry = mysql_query("select DISTINCT CATEGORY from proposals") or die(mysql_error()); // table 1 //////After getting the id from the table1 supply that posted id to get the resuls from the table2 ////////////// $secondQry = mysql_query("select DISTINCT AGENCY, CATEGORY from proposals where CATEGORY = '$_POST[CAT]' ORDER BY AGENCY") or die(mysql_error()); // table 2 $thirdQry = mysql_query("select NAME, AGENCY, CATEGORY from proposals where CATEGORY = '$_POST[AGCY]' ORDER BY NAME") or die(mysql_error()); // table 3 ?> <form name="check" method="post"> <!-- First DropDown starts here --> <select name="CAT" onchange="this.form.submit()"> <?php while($res = mysql_fetch_array($firstQry)){?> <option value="<?php echo $res["CATEGORY"]?>" <?php if (isset($_POST['CAT']) && $_POST['CAT'] == 'Highway') { echo 'selected="selected"';} ?>><?php echo $res["CATEGORY"]?></option> <?php }unset($firstQry,$res);?> </select> <!-- First DropDown ends here --> <!-- Second DropDown starts here --> <?php if(isset($_POST['CAT'])){?> <select name="AGCY" onchange="this.form.submit()"> <?php while($row = mysql_fetch_array($secondQry)){?> <option value="<?php echo $row["AGENCY"]?>" <?php if (isset($_POST['AGCY']) && $_POST['AGCY'] == '"echo $row["AGENCY"]"') { echo 'selected="selected"';} ?>><?php echo $row["AGENCY"]?></option> <?php } }unset($secondQry,$row); ?> </select> <!-- Second DropDown ends here --> <!-- Third DropDown starts here --> <?php if(isset($_POST['AGCY'])){ ?> <select name="NAME"> <?php while($row2 = mysql_fetch_array($thirdQry)){ ?> <option value="<?php echo $row2["NAME"]?>"><?php echo $row2["NAME"]?></option> <?php } } unset($thirdQry,$row2);?> </select> <!-- Third DropDown ends here --> </form>
  3. Right on! I'm not getting that Parse Error anymore, it was the semi-colon that fixed it The data is being passed onto the database now too! You guys/gals rock! I am also having trouble trying to figure out how to reference the drop down date results with PHP since it's a custom function. Here's the complete form with the function. <script language="JavaScript" type="text/javascript"> <?php function DateDropDown($size=90,$default="DropDate") { // $size = the number of days to display in the drop down // $default = Todays date in m:d:Y format (SEE DATE COMMAND ON WWW.PHP.NET) // $skip = if set then the program will skip Sundays and Saturdays $skip=1; echo "<select name=dropdate STYLE=\"font-family: arial;\">\n"; for ($i = 0; $i <= $size; $i++) { $theday = mktime (0,0,0,date("m") ,date("d")+$i ,date("Y")); $option=date("D M j, Y",$theday); $value=date("m:d:Y",$theday); $dow=date("D",$theday); if ($dow=="Sun") { echo "<option disabled> </option>\n"; } if ($value == $default) { $selected="SELECTED"; } else { $selected=""; } if (($dow!="Sun" and $dow!="Sat") or !$skip) { echo "<option value=\"$value\" $selected>$option</option>\n"; } } echo "</select>\n"; } ?> <form action="process.php" method="post"> <table width="410" border="0" cellpadding="2"> <tr> <td nowrap="nowrap"><div align="right">Trakker # </div></td> <td nowrap="nowrap"><INPUT TYPE= text NAME="idnum" ID="idnum" SIZE=30 MAXLENGTH=100 /> </td> </tr> <tr> <td nowrap="nowrap"><div align="right">Found By : </div></td> <td nowrap="nowrap"><INPUT TYPE=TEXT NAME="found_by" ID="found_by" SIZE=30 MAXLENGTH=100 /></td> </tr> <tr> <td nowrap="nowrap"><div align="right">Date Found : </div></td> <td nowrap="nowrap"><?php DateDropDown($size=90,$default="DropDate"); ?></td> </tr> <tr> <td nowrap="nowrap"><div align="right">City / Town : </div></td> <td nowrap="nowrap"><INPUT TYPE=TEXT NAME="city" ID="city" SIZE=30 MAXLENGTH=100 /></td> </tr> <tr> <td nowrap="nowrap"><div align="right">State / Province : </div></td> <td nowrap="nowrap"><INPUT TYPE=TEXT NAME="state" ID="state" SIZE=30 MAXLENGTH=100 /> </td> </tr> <tr> <td><div align="right">Country : </div></td> <td><select name="country" ID='country'> <option selected="selected" value="">(Select a Country) </option> <option value="USA">United States of America </option> //bunch of countries listed <option value="UNK">Not Listed___________________________ </option> </select> </td> </tr> <tr> <td nowrap="nowrap"> </td> <td nowrap="nowrap"><div align="left"> <input type="submit" name="submit" value="submit" /> </div></td> </tr> </table> </form>
  4. I'm having trouble processing an HTML form. I can't get the data to post into the mysql database and I keep getting a Parse ErrorParse Error in "file" on line 18. Here's the code for the HTML form: <form action="process.php" method="post"> <table width="410" border="0" cellpadding="2"> <tr> <td nowrap="nowrap"><div align="right">Trakker # </div></td> <td nowrap="nowrap"><INPUT TYPE= text NAME="idnum" ID="idnum" SIZE=30 MAXLENGTH=100 /> </td> </tr> <tr> <td nowrap="nowrap"><div align="right">Found By : </div></td> <td nowrap="nowrap"><INPUT TYPE=TEXT NAME="found_by" ID="found_by" SIZE=30 MAXLENGTH=100 /></td> </tr> <tr> <td nowrap="nowrap"><div align="right">Date Found : </div></td> <td nowrap="nowrap"><?php DateDropDown($size=90,$default="DropDate"); ?></td> </tr> <tr> <td nowrap="nowrap"><div align="right">City / Town : </div></td> <td nowrap="nowrap"><INPUT TYPE=TEXT NAME="city" ID="city" SIZE=30 MAXLENGTH=100 /></td> </tr> <tr> <td nowrap="nowrap"><div align="right">State / Province : </div></td> <td nowrap="nowrap"><INPUT TYPE=TEXT NAME="state" ID="state" SIZE=30 MAXLENGTH=100 /> </td> </tr> <tr> <td><div align="right">Country : </div></td> <td><select name="country" ID='country'> <option selected="selected" value="">(Select a Country) </option> <option value="USA">United States of America </option> //bunch of countries listed <option value="UNK">Not Listed___________________________ </option> </select> </td> </tr> <tr> <td nowrap="nowrap"> </td> <td nowrap="nowrap"><div align="left"> <input type="submit" name="submit" value="submit" /> </div></td> </tr> </table> </form> The date field is a javascript drop down thing. Here's the process.php code: <?php if(isset($_POST['submit'])) { include 'config_dino.php';//connection info mysql_connect($server, $db_user, $db_pass); @mysql_select_db($database) or die( "Unable to select database"); /*Posted information from HTML (dinos.php) form*/ $idnum=$_POST['idnum']; $found_by=$_POST['found_by']; $city=$_POST['city']; $state=$_POST['state']; $country=$_POST['country']; /*Insert posted information into bugz database - Table Dino*/ mysql_query("INSERT INTO 'dino' ('idnum', 'found_by', $city', 'state', 'country') VALUES ('$idnum', '$found_by', '$city', '$state', '$country')") } ?> I also want to redirect the user to "trakked.html" after the form has been processed, but I have no idea how. I'm obviously very new to PHP, thank you in advance for your help.
  5. Long story short. A friend of mine is into geocaching (http://www.geocaching.com). There are items called tracking bugs for geocaching, you can also create your own trackable items. There is a website called http://www.sigitem.com where this guy has created sites for people with trackable items, but I would like to create something a little more interactive and nicer looking like this one http://www.geofish.net
  6. Hello, This is my first post in this forum, I am also pretty new to PHP and mysql, and I'm having trouble wrapping my brain around it. This is kind of a PHP/mysql question. I am trying to create an item tracking website similar to http://www.wheresgeorge.com. I'm having trouble processing the html form, especially the "date found" portion. I also don't really know how to set up my tables in my database so that they work efficiently. The information I an requesting with the form is: item_number, found_by, date_found, city, state, country. I'm assuming that I will have to have more than one table in order for people to search by item_number or found_by etc. I know these are kind of broad questions, but let me know if you'd like me to post what code I have, or stick the files on my FTP for download. I am using SQL Manager for a mysql client and Dreamweaver CS3 for design. Thank you in advance for your patience with me, I know how it is to help newcomers
  7. Hello, This is my first post in this forum, I am also pretty new to PHP and mysql, and I'm haveng trouble wrapping my brain around it. This is kind of a PHP/mysql question. I am trying to create an item tracking website similar to http://www.wheresgeorge.com. I'm having trouble processing the html form, especially the "date found" portion. I also don't really know how to set up my tables in my database so that they work efficiently. The information I an requesting with the form is: item_number, found_by, date_found, city, state, country. I'm assuming that I will have to have more than one table in order for people to search by item_number or found_by etc. I know these are kind of broad questions, but let me know if you'd like me to post what code I have, or stick the files on my FTP for download. I am using SQL Manager for a mysql client and Dreamweaver CS3 for design. Thank you in advance for your patience with me, I know how it is to help newcomers
×
×
  • 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.