zendo Posted April 9, 2015 Share Posted April 9, 2015 Hello guys, am new to this forum. I have a question that i'd like some help with, this is part of my dissertation project. So i'm creating a system that will gather hardware parts from the database manually (I have 7 hardware parts for each component which is cpu,gpu,psu,motherboard,ram and case) for each and the user will input the price tag in the listbox ($300-$450) for example and the system will display hardware parts from the database within that price range. How can I link the listbox with the database? And how can I make the total price from hardware parts display depending on what the user pressed? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/ Share on other sites More sharing options...
ginerjm Posted April 9, 2015 Share Posted April 9, 2015 What listbox? People don't usually enter stuff into a listbox, so I'm curious what listbox you have that allows that Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508614 Share on other sites More sharing options...
zendo Posted April 9, 2015 Author Share Posted April 9, 2015 What listbox? People don't usually enter stuff into a listbox, so I'm curious what listbox you have that allows that What do you mean? The html tag with the select option I am reffering to isn't that listbox? And a submit button of course Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508619 Share on other sites More sharing options...
ginerjm Posted April 9, 2015 Share Posted April 9, 2015 At least we agree on what a listbox is, but you say the user is entering a price into the listbox. How is that possible? Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508621 Share on other sites More sharing options...
ginerjm Posted April 9, 2015 Share Posted April 9, 2015 Moving on - Trying to figure out what your question is. For what purpose do you want to link your listbox to your database? I'm assuming that you already building the listbox by getting data from the database and looping thru some results to build the option tags. Why do you need a link to the database, or in other words, what are you trying to do once you have it built? Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508622 Share on other sites More sharing options...
zendo Posted April 9, 2015 Author Share Posted April 9, 2015 Moving on - Trying to figure out what your question is. For what purpose do you want to link your listbox to your database? I'm assuming that you already building the listbox by getting data from the database and looping thru some results to build the option tags. Why do you need a link to the database, or in other words, what are you trying to do once you have it built? well let's say the listbox has the values 1. $300-$350 2. $351-$450 3. $451-$550 4. $550-$700 7. $700+ If the user decides to press the tag number 2 for example I want the system to output hardware components from the database with the price range from $351 to $450 Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508623 Share on other sites More sharing options...
cyberRobot Posted April 10, 2015 Share Posted April 10, 2015 Are you looking to display the hardware components as soon as a "listbox" choice is made...or after the form is submitted? Note that if you want to display the hardware components prior to the form being submitted, you'll need to look into a JavaScript / AJAX solution. Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508680 Share on other sites More sharing options...
zendo Posted April 10, 2015 Author Share Posted April 10, 2015 Are you looking to display the hardware components as soon as a "listbox" choice is made...or after the form is submitted? Note that if you want to display the hardware components prior to the form being submitted, you'll need to look into a JavaScript / AJAX solution. Well after the form is submitted, am just wondering on how this is achievable and on what I should focus on Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508685 Share on other sites More sharing options...
ginerjm Posted April 10, 2015 Share Posted April 10, 2015 Ok - now you have made yourself clear. If you re-read your OP you will see how it was confusing. All you really want to do is to click on an item and have that sent to the server for handling. Ok - so you should have this listbox inside a form element and have a submit button for the form that triggers your script. In that script you grab the POST element for your list box (whatever the name= is in the select tag) and validate it to be sure it is correct and then use that value to search your db for whatever info you want to send back to the client in a new output arrangement. Ok? Quote Link to comment https://forums.phpfreaks.com/topic/295381-link-listbox-with-database/#findComment-1508686 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.