Jump to content

Matt G

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Palo Alto

Matt G's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i can also send snippets of the code I have created if it helps!! //code $filterQuery = "SELECT * FROM table_2 INNER JOIN table_1 ON table_2.Option_Id=table_1.Option_Id where "; $list = split($filterList,","); $first = false; foreach( $list as $filter ) { if( $first ) { $filterQuery .= " WHERE AND "; } $filterQuery .= "table_1.Option_Category <> '" . $filter . "' AND table_1.Option_Type <> '" . $filter . "'"; $first = true; } $filterQuery .= ";"; $filterResults= mysql_query($filterQuery); $filter_row= mysql_fetch_assoc($filterResults); //code Im joining two tables on the same column and wish t eliminate the option category and or type IF third radio button is selected..
  2. i can also send snippets of the code I have created if it helps!!
  3. Hello everyone, I have dynamically created a series of radio buttons, with "Options" populated from mysql: e.g. "Option 1" radio button 1 (OK) radio button 2 (Maybe) radio button 3 (Eliminate) "Option 2" radio button 1 (OK) radio button 2 (Maybe) radio button 3 (Eliminate) Etc... I have created a javascript loop (to loop through the form)... I have also created a script and table to display the results dynamically.. However, I am having trouble querying the sql database to display the proper results.. HERE'S WHAT I NEED: When radio button 1 is selected, I need the query to grab the selected "Option" to be displayed/printed. When radio button 2 is selected, I need the query to grab the selected "option" and isolate it to be displayed/printed in a separate area(of the results page) But when radio 3 is selected, I need the query to not grab this "option".. This "option" should be hidden from the user on the results page! Im sure there must be a million ways to do this, but I cant find any articles that seem to help.. or maybe Im looking in the wrong place??! Please Help I would greatly appreciate it!! Sorry if this seems confusing and Thanks in advanced!!!
  4. Hello everyone, Im still new to JS/Ajax/PHP and Im creating a filter(html checkbox form) that will call a single query that will filter unwanted items.. This query contains a INNER JOIN, AND and ON conditions. I have also created a simple javascript loop to scan the form for checked values.. but im having trouble connecting the dots.. Im not certain how to make each checked value trigger individual parts of the query.. Heres what I have: Loop: function sendInfo(form) { var filterList = ""; for( var i =0; i < form.elements.length; i++ ) { if( form.elements[i].type = 'checkbox' ) { if( form.elements[i].checked == true ) { filterList += form.elements[i].value + ','; } } } alert("The filter list is " + filterList); } HTML FORM: <form name="filterForm" id="filterForm"> <input type="checkbox" name="red" value="red" id="red"> RED <input type="checkbox" name="blue" value="blue" id="blue"> BLUE <input type="checkbox" name="green" value="green" id="green"> GREEN <input type="submit" name="submit" value="click" onClick="sendInfo(document.filterForm)"> </form> PHP/Mysql QUERY:(used to filter results) $submitFilter= isset($_POST['submit']); if($submitFilter) { //checks for submitted form //connect to database //select database $filterQuery= mysql_query("SELECT * FROM table_1 INNER JOIN table_2 ON table_1.color_Id=table_2.color_Id WHERE table_2.color_Category <> 'red' AND table_2.color_Type <> 'red' AND table_2.color_Category <> 'blue' AND table_2.color_Type <> 'blue' AND table_2.color_Category <> 'green' AND table_2.color_Type <> 'green' As you can see I have joined two tables and want to exclude any from table_1 where the color is red.. how can I request this action from the loop once a check box has been checked??? like I said im new so if this looks wrong/confusing feel free to be brutal !! I have searched the forums and Iv been close to finding an example/post but nothing solid.. I think I mayb using the wrong terminology/descriptions in my searches to find the correct results bcuz I feel like im circling the block to no end.. PLEASE HELP or POINT ME IN THE RIGHT DIRECTION!!!!! THANKS IN ADVANCE FOLK!
  5. Thank you for the help Gristoi, I'm currently working through a few issues with my actual form code...but this is def a step in the right direction and I greatly appreciate the help ! Thnx again!!
  6. Hello everyone, Im fairly new to HTML, PHP and MySQL and I have been researching for weeks to find a script that allows me to search specified database tables for checkbox values.. I have come across a number of articles and forums that discuss methods of retrieving/displaying submitted checkbox values &/or populating checkbox forms with database values; but none have explained how to conduct a MySQL table search using selected(checked) checkbox values.. I have a html checkbox form that has values: RED, BLUE, GREEN, SHIRTS, PANTS, SHORTS; my RETAIL DATABASE consists of two tables( each table represents a specific retail store) Store 1(Table_1) and Store 2(table_2); Rows within the table consist of a ID (Primary& Auto_INT); Product_Name(Varchar) and a Product_Description(Text).. For example: I would like the checkbox form to search the "Product_Descriptions" of "table_1" and return the "Product_Name(& description)" from MySQL; but Im having sooo much trouble getting started or finding a usable reference... Here's what I got so far: <form action="...php" method="post" name="search_form" onsubmit="return Checkckeckboxes(this);"> <input type="checkbox" name="search['table_1']" value="blue" id="search1"/> Blue<br/> <input type="checkbox" name="search['table_1']" value="red" id="search2"/> Red<br/> <input type="checkbox" name="search['table_1']" value="green" id="search3"/> Green<br/> <input type="checkbox" name="search['table_1']" value="shirts" id="search4"/> Shirts<br/> <input type="checkbox" name="search['table_1']" value="pants" id="search5"/> Pants<br/> <input type="checkbox" name="search['table_1']" value="shorts" id="search6"/> Shorts<br/> <input type="submit" value="search"/> </form> //not sure what information is to be placed in the "id" section..if any Database name is: RETAIL_STORES Table_1 ( represents store number one) Id (primary, auto int) //i.e. 1 Product_Name (Varchar) //i.e. Golf Shorts Product_description (Text) //i.e. Green, Shorts, etc Table_2 (represents store number two) Id (primary, auto int) //i.e. 1 Product_Name (Varchar) //i.e. basketball shirt Product_description (Text) //i.e. red, shirt I want this form to search for selected(checked) values in Table_1 via product_Description and display the Product_Name and description to the user.. But im sure my form parameters have NOT accomplished this and I need code help to achieve my goal.. I know someone on this forum can help or at least get me started in the right direction..PLEASE HELP!!!!!!
  7. Hello everyone, Im fairly new to PHP and MySQL and I have been researching for weeks to find a script that allows me to search specified database tables for checkbox values.. I have come across a number of articles and forums that discuss methods of retrieving/displaying submitted checkbox values &/or populating checkbox forms with database values; but none have explained how to conduct a MySQL table search using selected(checked) checkbox values.. I have a html checkbox form that has values: RED, BLUE, GREEN, SHIRTS, PANTS, SHORTS; my RETAIL DATABASE consists of two tables( each table represents a specific retail store) Store 1(Table_1) and Store 2(table_2); Rows within the table consist of a ID (Primary& Auto_INT); Product_Name(Varchar) and a Product_Description(Text).. For example: I would like the checkbox form to search the "Product_Descriptions" of "table_1" and return the "Product_Name(& description)" from MySQL; but Im having sooo much trouble getting started or finding a usable reference... Here's what I got so far: <form action="...php" method="post" name="search_form" onsubmit="return Checkckeckboxes(this);"> <input type="checkbox" name="search['table_1']" value="blue" id="search1"/> Blue<br/> <input type="checkbox" name="search['table_1']" value="red" id="search2"/> Red<br/> <input type="checkbox" name="search['table_1']" value="green" id="search3"/> Green<br/> <input type="checkbox" name="search['table_1']" value="shirts" id="search4"/> Shirts<br/> <input type="checkbox" name="search['table_1']" value="pants" id="search5"/> Pants<br/> <input type="checkbox" name="search['table_1']" value="shorts" id="search6"/> Shorts<br/> <input type="submit" value="search"/> </form> //not sure what to write in the "id" field(or if its needed) Database name is: RETAIL_STORES Table_1 ( represents store number one) Id (primary, auto int) //i.e. 1 Product_Name (Varchar) //i.e. Golf Shorts Product_description (Text) //i.e. Green, Shorts, etc Table_2 (represents store number two) Id (primary, auto int) //i.e. 1 Product_Name (Varchar) //i.e. basketball shirt Product_description (Text) //i.e. red, shirt I want this form to search for selected(checked) values in Table_1 via product_Description and display the Product_Name and description to the user.. But im sure my form parameters have NOT accomplished this and I need code help to achieve my goal.. I know someone on this forum can help or at least get me started in the right direction..PLEASE HELP!!!!!!
×
×
  • 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.