Connecting Two Database Populated Select Menus
I am able to grab the data from the database to populate the menus individually using. PHP Code:
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Dependent Select Menus
I would like to create a form in which a 2nd select box appears depending on the value selected in the 1st select box. The values of the 2nd select box will come from a database. My question is how to create this in php? One way is to re-load the page depending on what's chosen in the first box, or alternatively to use frames or an iframe? Is there another, better way that can dynamically change the initial page?
Using PHP And MySQL To Populate (select) Menus
I am a newbie to php *gasp* and I am trying to make a <select> drop down menu, but I want the menus populated by information from a field in my database. There are a bunch of entries in the field MUD, that are identical......I would like the menu NOT to repeat identical names. EX... Each name only once, even though it is in the database many times.
Drop Down Populated By Database
Hopefully someone can help me with this: I currently have a php file that pulls a query from the field "category" from my database. this file is called category.php. I am trying to populate a drop down box in another page (called add_subpage.php) from the results of the category page. the code below is on the add_subpage.php file: (It was my best guess and does not work) <select name="category"> <option value="CAT"<?php include 'category.php' ?>></option> </select> Can anyone tell me how to make this drop down populate from the category php file?
Drop Down Populated By Database
I currently have a php file that pulls a query from the field "category" from my database. this file is called category.php. I am trying to populate a drop down box in another page (called add_subpage.php) from the results of the category page. the code below is on the add_subpage.php file: (It was my best guess and does not work) <select name="category"> <option value="CAT"<?php include 'category.php' ?>></option</select> Can anyone tell me how to make this drop down populate from the category php file?
Add Data To A Database Using Dropdown Menus?
lets say i had a database with a table called admin hacks and another table called user hacks,and both tables had feilds called name and id now what i want to be able to do is create a submit form with a drop down menu saying the table names mentiond above, also the form will have a field called name. now lets say a user slected admin hacks from the drop down menu and enterd jack in the name, how would i get the data in that submitted form to be inserted into the correct database table, so jack should now be in the table called admin hacks also lets say someone selected user hacks and entered jon how would i do the same for that?
Connecting To SQL Database
I have been asked to create an e-commerce website, where we need to connect to an SQL database. The database is used to run their POS in several branches. As this database is on the company server and we are hosting the website with a webhost we have to solve an communication issue. Here are the options that I can see: a. create a branch like environment on the webserver and then directly access the branch database (OBDC??) b. run a script that sucks data from the SQL environment and then ftps it as a text file to a LAMP server. PHP and Mysql (my preferred platform), will then notice the new file and do something with it? c. have a direct OBDC connection between the website and the company's server What option do you recommend? What difficulties do you see? I would love to get some ideas from you and more ideas on the typical problems.
Connecting To A Mssql Database
I tried to connect to a MSSQL database and I was told I had an invalid function call, function not defined. Is there an add-on that needs to be installed for MSSQL to work properly? $dbconn = mssql_connect("localhost:,"user","password");
Connecting To A Database On A Different Domain ...
I have several sites that need to use a single database. Each site is on a domain of its on with the database on a separate domain. I usually use : ----- $connection = mysql_connect("localhost","username","password") or die("Couldn't make a connection."); $db = mysql_select_db("database", $connection) or die("Couldn't select database."); ----- ...but since the database is not on the "localhost", how do I form the php code to link to an external database? I have set the external sites as "Access Hosts" on the main site. What do I do to connect these external sites to the main database?
Connecting To A Mssql Database
Im having major problems trying to connect to a mssql database thats hosted on our server. I've got the ip, username, password and database name, yet no matter what i try, I cant seem to connect. I've trawled the net for hours looking for code, has anyone got any that definately works, or just a simple way I can check the connection.
Security Of Database Connecting Scripts
Is it insecure to have all pages of a site require a common.php page that has the sole purpose of connecting to the database?? If someone found the location of this could they not require it on there webpage and manipulate my database?
Connecting To MS Access Database From PHP On Linux
Does anyone know if its possible to connect to an MS Access database, via PHP on a Linux O/S. I had mistakenly assumed that I could achieve this with the ADODB database abstraction layer, since it lists Access as a supported database. However, I now understand that this is limited to PHP running on a Windows Server, due to some library/libraries required.
Database Value Select In Combo Box!
This function is intended to display the current database field value as selected.. along with other values as general options. I can't figure out how to get it work. Help is appreciated!! function retrieve_category() { $cat = mysql_query("SELECT category_id FROM category"); while ($current_row = mysql_fetch_row($cat)) { $row = $current_row[0]; if ($row == $id) { printf("<option selected>%s</option> ",$current_row[0]); } else { printf("<option>%s</option> ",$current_row[0]); } } }
Populating A Select Box From A Database
I have a subscription database that allows you to edit a subscribers data. For example, you enter a search term like "Bob" and it returns a list of everyone named Bob. You click the one you want and it goes to a subscriber detail page, where all of his data is populated to a form. You can directly edit this form and click save to overwrite it. The only issue is the select boxes (drop downs) - say I have four options in the drop down box, red, blue, green and black. On my details page for bob I end up with five, I have those four PLUS whatever was saved for his color, so it shows up twice. If Bob is green, my select box looks like: Green Red Blue Green Black How can I make it so that Green only shows up once?
Select One Record From A Database
I am trying to select one record from a database. This databse has like 10 tables. I do not know which table this record is in. What php and mysql syntax would I use to accomplish this?
Randomly Select From Database?
this might seem like a stupid question, i should be able to do this. but on the front page of my site i want a thing to show a few users. but i dont want it to show the same people over and over. i want it to select different people each time. any ideas?
Selective Echoing And Database Select
I have written a search engine for business listings for the company I work for. Each listing is in a database, and that works fine. The problem though is two-fold. The first part of the problem is that not all listings utilise every column of the database, and this leaves gaps when echoing the results. This is not what i had in mind, Any ideas/help would be appreciated. The second part of the problem is related to the first in that there is a link for any listing that has a website, but not every listing has a website, so every listing having a "Visit our Site" link is impractical and shoddy. Also, i'm not sure how to echo the url from the database effectively in the first place.
Editing Mysql Database Row With Select Box
I have a small site, this small site has a few categories, now I can add items through my online admin area fine and delete them fine, but when it comes to editting them I am having some trouble, everything is working fine except the category column, because it is a drop down box I do not know how to have the category selected during the creation progress selected all the other info is loaded.
Multiple Select From Database Where Clause
I have a website with a database full of category names...I want to be able to chose lets say 5 of these categories and use a select from database clause where I could simply enter the category names I want to use but am not sure how I would go about doing it. I can get the list to display just the Aprilia category using the code below: $data1->q("SELECT * FROM categories WHERE cat_name = 'Aprilia' ORDER BY cat_name asc"); However...how could I get my site to display Aprilia, Ducati, Honda, Suzuki, Yamaha?
Using PHP And MYSQL To Select From Database Using Images
I'm trying to update a main page with a list of details matching a selection from a display of images that are displayed in a small window that have been selected from an image group using a select box in the main window, however I don't know how to do this and the main page is not receiving anything when clicking on an image so it's refreshing with empty data. I've seen many many pages giving examples of how to do this with select boxes or how to do this if only one entry uses an image shown in the small window, but the image display window is displaying many different small images not a select box and the database itself has multiple entries that use the same image. Can anyone help? I have a few instant chat programs if someone wishes to discuss this with me in real-time to see what it is I'm trying to achieve.
Tick Box, Select And Update Database.
I am trying to change the value in table with a tick box. If the tick box is selected it changes the value in the field to 'y' and if it is not selected it changes the field to 'n'. First of all I need to bring back the current state of the field and then I need to be able to update it from 'y' to 'n' as many times as I want. Code:
Population Select Menu Using Php And Database Values
I have no idea how to go about this. so i would apreciate some help i want to populate the values in a html select menu from database values in one table so i want all the values from 1 particular field in the database to be displayed in the select menu as separate options.
Displaying A List Of Categories From A Database In A Select Box
Could someone please tell me why this outputs nothing <select name=categories> <? $cat_array = get_categories(); foreach($cat_array as $this_cat) { echo "<option value=""; echo $this_cat["category_id"]; echo """; echo ">"; echo $this_cat["category_name"]; echo " "; } ?> </select> ========================================================== function get_categories() { //get the list of categories from the database $conn = mysql_pconnect("localhost", "user", "pwd"); $query = "select * from categories"; $result = mysql_query($query); if(!$result) return false; $num_cats = mysql_num_rows($result); if($num_cats == 0) return false; $result = db_result_to_array($result); return $result; } //A function that returns a query to the database as an array function db_result_to_array($result) { $res_array = array(); for($count=0; $row=@mysql_fetch_array($result); $count++) $res_array[$count] = $row; return $res_array; }
Select Specific Phrase From MYSQL Database
I am working on a World of Warcraft guild's website and I am trying to create a page where players can select different kinds of gear, i.e. the gear with the most Stamina. All the player's items are stored in the database and every item have a field in the Items-table containing the item's tooltip. This could look something like: Boots of the Nexus Warden Soulbound Feet Cloth 97 Armor +27 Stamina +17 Intellect Durability 35 / 35 Equip: Improves spell hit rating by 18. Equip: Increases damage and healing done by magical spells and effects by up to 21. I then want to select the item with i.e. the most Stamina for all the different slots; Head, Chest, Legs etc. If I write this: $query = mysql_query("SELECT substring(item_tooltip, LOCATE('Stamina', item_tooltip)) AS maxor FROM roster_items WHERE member_id = ེ'") or die(mysql_error()); It returns the following: Stamina +17 Intellect Durability 35 / 35 Equip: Improves spell hit rating by 18. Equip: Increases damage and healing done by magical spells and effects by up to 21. But I want for it to show the leading characters also (in this case "+27 " before "Stamina") and then not show anything else after the phrase "Stamina". So it shows "+27 Stamina" and nothing else for the above mentioned item. How do I accomplish this? And then, secondly how do I then get it to show only the item with the most Stamina after it selected the above? Hope this makes any sense. I've tried to search these forums and found something a little along the lines of my problem but haven't been able to adjust them to my needs and I therefore need your help which will be greatly appreciated.
Reusing An Object For Common Select To Database
I've noticed that after I finished this app, I had repeated a similar task over and over and would like to modularize it. The repeated task was connecting to the database, executing a select, putting all the results of the columns into different variables of an object. PHP Code:
Simple Filter Of Database With $_GET And Select SQL
I need help with my logic statement with a simple search engine on a MySQL table. I have three form text input fields named f_name, l_name and dept. I am using the GET method to gather data the user enters in each input field. So far I have been able to build a check to see that the submit has been clicked but I am having trouble with assembling the SQL statement because I need for the search engine to be able to filter the results based on the information provided in 1-3 of the fields. I could use if statements with some and clauses but that would mean that I would have to account for each combination. Something like If(($_GET[‘f_name’] != “”) || ($_GET[‘l_name’] !=) || ($_GET[‘dept] !=)){ $sql = "SELECT * FROM facform WHERE f_name LIKE '$_GET[f_name]', l_name LIKE '$_GET[‘l_name]', dept LIKE '$_GET[dept]' ”;} The problem with this is that I would have to get every combination and it’s not very scalable. How can I create this SQL statement dynamically? Code:
Dropdown List - Trying To Get Default Populated From Db.
Nooby question but when I try and get this to work (it should identify which rows in the database have GK, MID, DEF, FWD against them and then put SELECTED into the option value to give a default of what the entry is currently) it just adds SELECTED to all the results as if $row["Position"] is returning true against all four conditions? What am I doing wrong? CODE:..
Dropdown Populated From Mysql Field
I'm looking to create a drop down box that displays a field from a a mysql DB so that i can list all the names and when I select a name from the list it selects that record.
Trying To Make Populated Drop Down Box Query
My host is Godaddy, sql 4.1 - trying to create a populated drop down list that when submitted, displays the info row by row. I can populate the list, and when I post it takes me to the next page. The php on the next page makes the table header but there is no data underneath. There is data in the table cause I can display it all on another php page I have. Code:
Error In Generating Table From Database Select Statment
I am trying to dynamically create a table with the results from a select statement. Below is the code that is not working. Any help would be oh so greatly appreciated. This is for a final at school which is due in an hour. This is the only thing I can't seem to make work. Code:
Dynamic List Populated By MySQL Table
I am building my first php page and I've ran into problems trying to create a dynamic drop down list for an INSERT page. My page is based on this example from mysql.com. I want to populate the list from a table in MySQL, but when I test the page the list only contains the first record. If anyone can help me out, or recommend an easy way to create dynamic menus/lists, I will be very grateful. This code appears above the FORM ACTION: $NearMajorCity = mysql_query("SELECT NearMajorCity_ID, NearMajorCity FROM NearMajorCity"); This code is within the FORM: <SELECT NAME="NearMajorCity" SIZE=1> <OPTION SELECTED VALUE="">Select One <OPTION VALUE="">--------- <?php while ($NearMajorCity = mysql_fetch_array($NearMajorCity)) { $NearMajorCity_ID = $NearMajorCity["NearMajorCity_ID"]; $NearMajorCity = $NearMajorCity["NearMajorCity"]; echo("<OPTION VALUE='$NearMajorCity_ID'>$NearMajorCity "); } ?> </SELECT> I want to be able to view the names of the Major Cities in the list, but I want the NearMajorCity_ID inserted into the table.
Any Reason Why $_FILES['userfile']['error'] Wouldn't Be Populated?
I am in the middle of writing an image upload script and am limiting the size of uploads via upload_max_filesize. This all seems to be working well, and if I try and upload a bigger file then I get an UPLOAD_ERR_INI_SIZE sat in $_FILES['userfile']['error']. All hunkey dorey. However, in my testing there are one or two large files that cause problems. PHP appears to abort the upload early as it should, but when my script runs, $_FILES isn't populated at all?! I have tried to narrow down the difference in these file but I can't seem to find anything definate. All the ones that fail are AVI or WMV files if that gives any clue, but even if I rename them to MPG (others of which work ok), and check the MIME type being sent up has also changed to mpg, then they still fail as before. I have sent bigger and smaller files all ok, so it's not size. I can't see anything in the filename itself that would cause problems.
Select Specific Snippet Of Text, Replace With A Database Result
I'm having some problems trying to do something; I just can't think of a way to do it. Basically, I want to search for a specific snippet of text in a body of text, then replace it with the requested database result with some thrown in HTML. Users will be able to type the following (or something along these lines, depending on what works best): [image=12345]Insert caption here[/image] Then I need it to search for the requested image in the appropriate table and return the image's url (for an example, let's say the table is called "images", and the columns required are "imageid" and "imageurl". Code:
Open Popup Window When Page Is Loaded If A Field Is Populated
Would it be possible to open a popup window on loading the instruction page but only when the critical information section of the page contains text? The popup window could either contain the contents of the critical information section or just a visual warning that such information exists on the main page. I have a pretty good knowledge of VBA but sadly my knowledge of php and javascript is very limited.
Menus In Php
currently i have web application in php which has its menus created in javascript. if we do view source on the page, it displays all the javascript which is obvious n natural. but it displays all the file names of php too which are related with those specific menus. dont we have any way by which we can prevent it. as an alternate i m thinking of creating the menus also in php so that the names of my files dont get visible to the user from the security point of view. is it sensible to do so because it will be an extra overhead to the system for creating the manus everytime.
Dynamic Menus
how to have dynamic menu, say one option is selected from the first menu, and that option changes the 2nd menu options. ? yeah i have seen it work in JavaScript, (onchange) but what would the syntax be in php ?
Sticky Menus
It's common courtesy to ensure that a form with validation problems reposts with the fields still filled in, so the user doesn't have to start over, by echoing the variables in the Value attribute of the text fields, but I also want to have a drop-down menu to be sticky and retain its selected state when the page reposts.
PHP And Drop Down Menus
I've looked through the forum rather extensively and my qestion is similiar to the question by Brian_F and answer by "saintaw" a couple of days ago in this forum. I already have a functional page that has several dynamic drop-down menus from which the user selects a topic of interest. My question is how to reference their choice from the drop down menus in order to display the results of their choice. I would like the user to be able to choose a subcategory with one of the drop down menus and then be able to view the questions related to that subcategory. I currently have a nested for loop which displays the categories and subsequent drop-down menus for each category, and I'm using PHP and MySQL to do the dirty work. code:
Dynamic Menus
<?php include('./common_db.inc'); $link_id = db_connect(); mysql_select_db("test_db"); ?> <form name=carform action= <?php echo $_SERVER['PHP_SELF']; ?> method=post> <?php $query =mysql_query("select DISTINCT CQ_PROD_PLATFORM AS make_id from CQ_data ORDER BY make_id"); echo '<select name=make onchange="document.carform.submit()"'.">"." "; if (!isset($make)) { echo '<option value=null selected>Choose a Make</option>'." "; } while(list($make_id) = mysql_fetch_row($query)) { echo '<option value='.$make_id; if (isset($make)&& $make_id == $make) { echo " selected"; } echo '>'."$make_id".'</option>'." "; } echo '</select>'." "; echo '<select name=model onchange="document.carform.submit()"'.">"." "; if (!isset($make)) { echo '<option value=null selected>Choose a Make First</option>'." "; } else { $result = mysql_query("select DISTINCT CQ_SUBSYSTEM AS name from CQ_data where make_id='$make' ORDER BY NAME"); echo '<option value=null selected>Choose a Model</option>'." "; while(list($model_id) = mysql_fetch_row($result)) { echo '<option value=' . $model_id; if ($model_id == $model) { echo " selected"; } echo '>$model_id</option>'." "; } } echo '</select>'." "; ?>
Php And Drop Down Menus
I have a question about PHP and drop down menus. Should I be using PHP for my drop down menus or should I be using java script? I have a whole contact form that is programmed in PHP, but I have never done a drop down menu with PHP, is this possible? If anyone knows of any great drop down menu tutorials in PHP.
Selecting Using Pull Down Menus ??
Just wondering how do u create that "ALL" search in php. For example i created a simple pull down menu (category) that has 3 options where each option has an id no. So my select command is " select * from tablename where id = /"id/" and lets say option 1 will have id 1 and so on. But what i got stuck in was creating an ALL search does n e one know how to do them ?
Dynamic Drop-down Menus
I am developing an on-line booking system, and am designing a script which creates a booking "area". An area has the following fields: Area Name Day start time (the time of day bookings can begin e.g 9 AM) Booking Time Slot (the length of time for each time slot e.g 30 mins) Day Finish Time (the time of day bookings must finish e.g 6 PM) What i require is a method for locking down the users input so that the finish time is a list that is created that is divisable by the number of minutes used for a booking time slot . e.g. if the start time is 9 am and each booking time slot is 30 minutes, then the user must select a finish time which is divisable by 30 i.e. either on the hour or half past. I have looked at several methods for doing this but cannot decide what would be suitable. Ideally I want the user to be able to select the start time from a dropdown (static html would do) the select a booking time slot (again a static html dropdown would surfice) and then a dynamic dropdown be created with a list of Day Finish Times. My questions are these: Is this the right way to go about doing this - are drop downs my best option? If so, is calculating the day end time list the best way to go? Would javascript be more suitable, rather than a php form?
Getting Data From Drop Down Menus
I have a drop down menu and I'm trying to find out which option they have pressed. I need to use the $_POST method to do this. Below is what i've written so far, but it's showing every time the messages: "You don't have enough points" AND "you gained blah blah exp" I've blocked out some of the stuff that calls up files and stuff, just for security reasons Code:
Dynamic Pull Down Menus
I was wondering if a kind person off here could point me in the right direction. I'm making a form on my website so users can request certain information, the thing is, the information they will be requesting will contained in pull down menus, with all the data for the pull down menus in a database. How would i go about changing one set of pull down menus depending on what is selected in a previous menu? For example, say a user selects "Honda", the next menu would contain all the Honda models in our database, if the user selects something else, they're given more choice again.
Dynamic Menus And Blob Problems
I have a database table with three fields, id, caption and data. I have used the id and caption to create a dynamic menu. it just throws it into a loop with extra html formatting stuff. No problem. The data field is a large blob. The data is a complete html file which comes out of a timing system for race cars, its basically a big table. How do I render the blob data within the current window or in a new window when the link is clicked, its got me stumped. I have used php to bring the page together using include statements, header footer and side_nav. the menu gets produced in side_nav.
Dynamic Menus And Blob Problems
I have a database table with three fields, id, caption and data. I have used the id and caption to create a dynamic menu. it just throws it into a loop with extra html formatting stuff. No problem. The data field is a large blob. The data is a complete html file which comes out of a timing system for race cars, its basically a big table. How do I render the blob data within the current window or in a new window when the link is clicked, its got me stumped. I have used php to bring the page together using include statements, header footer and side_nav. the menu gets produced in side_nav.
Drop Down Menus And Form Processing
I select a client from the first drop down menu, then a list of events for that client is shown in the second drop down menu. I then want to select the event from the second drop down and automatically go to a form I built "editevent.php3" showing information echoed from mySQL for that event. I have started the code, but know it is not complete. Code:
|