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:..
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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.
Dropdown - Default Value
I want to be able to have a drop down list that doesn't necessarily have the first item as the default. The content is being populated by PHP so I have no idea how to do it.
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.
Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all the bits and pieces together, all bar the code which takes the result of a query and creates a list box.
Dropdown List
I have a Dropdown list with Select with 1, 2, 3, 4, after select on of them it bust to refresh the page to what you select but it don't do it. PHP Code:
Dropdown List
i am trying to get two dropdown lists working on a page. How do i go about this. For example, I have 1 table which holds countries and cities. When a user selects a country in the first dropdown list, i'd like the second dropdownlist populate with a list of cities etc. from my database.
Populating Dropdown List
I am wanting to know how to populate the <SELECT> dropdown menu with all existing values from the DB and also have the value associated with that id selected. This is an updating area of my admin. Any ideas? Here's the code so far. At the moment it only retrieves the value assigned to that id. PHP Code:
Smarter Way Of Doing Dropdown List?
I've got a dropdown list that is acting as a filter on a table, so the user can select a value and the page is reloaded only showing the matching values from the database.
Now when the page reloads the dropdown was set to 'all' as it was first in the list, even if I'd selected a different value, this was confusing for users, so I added an initial <option> field which pulled the correct value from $_GET (code below) - however this is a little odd as it means the value appears twice!
Does anyone have a genius solution to this? I've seen a <select selected="yes"> sort of thing around, but I don't know how I can tell the php to add this value dynamically?
<select size='1' name='occupation'> <option>".$_GET['occupation']."</option> <option value='All'>All</option> <option value='Student'>Students</a></option> <option value='Professional'>Professional</option> <option value='Hobbyist'>Hobbyists</option> </select>
Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...?
what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table?
1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code.
2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know?
i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.
Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server.
I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).
Cascade Dropdown Or Conditional List
I would like to create a conditional cascade form. based on the selection, it can display or not display an input form for the user to enter an string of text. then at the bottom of the page (or when a user submit) connect all the sections including the input field all together (it's like a story maker?)
Microsoft Access Dropdown List
l am building a new site using PHP which has a lot of pages pulling from an Access Database. I would like to have a dropdown list that pulls exhibitions from the database and then when the user selects one it shows the rest of the details from DB just below the dropdown list, hope that makes sense. Code:
Change List View To Dropdown Menu
Im working on a script that has to be change so a user can choose from a dropdown menu instead of a list that now is displayed. Here is the part that is insert on the index page.
Easy Comma-delimited List To Dropdown Box Converter
I was working on a simple converter when I realized that by not setting the id param of the option tag, it wasn't going to send the value of the dropdown box to my php script. I had this to start with: Code:
Dynamic Dropdown And Hardcode Dropdown In Select Form
I have plenty of examples of dynamic dropdown choices but none of hardcoded dropdown choices. The ultimate goal is to have a job with various tasks and to track the status of those tasks for a given job. I've used one of the tutorials here to begin the process. Below is the code I have to add work on a given task. Perhaps I actually need to "Update" a job as opposed to "add".
But the problem of the moment is I can't seem to hardcode one set of my options. This is the code I have: PHP Code:
Database Stores Default Number Everytime, But I Havent Set A Default Number??
Im having some problems with my database. Everytime i store a number which is longer than 10 numbers the script or database puts this number into the database: 2147483647. Its does this everytime no mather how i write the numbers and nomather how long the number is, it just needs to be over 10.
I have set any default value in the database and to be sure i havent i tried deleting the table, but same thing happends again???
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?
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:
Connecting Two Database Populated Select Menus
I am able to grab the data from the database to populate the menus individually using. PHP Code:
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.
Using Natsort On A MySQL Populated Drop Down Menu
I am trying to use the natsort function on a dropdown menu which is populated by the mysql database. 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.
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:
- reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul>
etc.?
So basically it creates a list of links with the contents in that directory, so you can download them from there.
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.
What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.
SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100
What I'm getting, though is a list that looks like this:
mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1
I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.
If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.
mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1
How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let users to reach out to all recipient on the list by simple send the email to a specific maillist- address.
Mailman has this functionn but as a just got a webserver account I can't use mailman nor install it.
GD Default DPI
I'm currently making a website that needs to edit images with adding text, the problem is, the picture starts at 300 DPI (pixels/inch), but after GD edits the image, it's set to 72 which i read to be the default value GD always uses. is there a way to edit that default to a higher number, if not are there other ways to edit images through php and still keeping the original DPI.
Magic_quotes_gpc On By Default In PHP 4.3.3?
Prior to upgrading to PHP 4.3.3 (Windows), magic_quotes_gpc was turned off in the php.ini file. However, when I upgraded, I told the installer overwrite my previous php.ini files. I didn't have anything special in my previous version of php.ini and I wanted a clean slate.
After I upgraded to 4.3.3, I noticed that my scripts were acting strange, specifically form input. I checked php.ini and found that magic_quotes_gpc was turned on.
I unzipped the installer exe and upon inspecting the php.ini, I found the default php.ini included had magic_quotes_gpc On.
I thought they were going to set magic_quotes_gpc off by default in the later versions.
Anyone know why they did this? Was it a mistake?
What Is Better As A Default Value: NULL Or ''?
I would like to collect some statistical data and then make some reports on it. I'm creating tables for this task and i'm not sure what is better for filling default values: NULL or ''. What is optimal for storage purposes and for further reports creation?
Default Image
How can I write a function in such a way that it would look for a specific image to load. If that image exists on the server it will load it, if not it will load a default image.
Default Variable Value
Does php provide a built in way to use a variable's current value if that variable is already set but to use a default value otherwise. That is, a more compact syntax for:
$some_var = isset("$some_var") ? $some_var : "default value";
Set Column Default
we have a table sistock with column cameramodel varchar(30) and try to set default value to blank with the following:
ALTER TABLE SISTOCK CHANGE COLUMN CAMERAMODEL CAMERAMODEL ENUM ('INSTOCK', 'BACKORDER','SERVICE','OBSOLETE') DEFAULT '';
and we get an error at the mysql prompt;
ImageString: How Do I Use A Font That Is Not One Of The Default 5?
I am playing with imagegd for generating images, and was wondering if there is a way I could use a font that is not one of the default 5? I remember reading somewhere about a TT font library for imagegd, but don't remember the specifics. If someone could point me in the right direction I would appreciate it.
Problem On Default Value : : MySQL
Problem on default value : : MySQL I am facing problem in this line
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
when I tried to crate a new table in MySQL(version 3.23.47-nt)
Default Option On Select Box
I need to make a field in a admin form to be a drop down select box. I have the field right now as: PHP Code:
Using Default DB, User, Password
How do I use odbc.default_db, odbc.default_user and odbc.default_password defined in php.ini in the mssql_connect() function? I do not want to define these vars globally at the application level for many reasons. Shouldn’t calling the function without any parameters force PHP to look at the INI file for the defaults?
Form With To Submits, Which One To Default To?
Say, I have a form. Both cancel and save (in that order) are submits, then in the code I check which button was pressed. The point is that I want the save button (2nd) to be default, not the cancel. Is there a way (in js?) to "focus" the other button? One other way to be some simple js, which submits the page anyway......
Object Default Value In Constructor
I'm trying to write a class with a constructor that takes a single object parameter. So far so good, but I can't for the life of me make the parameter optional. I understand how to do it with a numerical or textual parameter, but not with an object. I tried null, but it doesn't work.
class A { }
class B { function B($a = ???) { if (!isset($a)) $a = new A; } }
Default Selection From Query
I'm having difficulty trying to have a DEFAULT selected record from a query in my dropdown box (code below). I have about 20 records in a 'facility' table, which listed names of our company's locations. I want to default select one of those records "exton" to be selected in my dropdown box. Code:
PHP Default Host Best Practices
I've got my dev and production environments all setup, and the mysql DBs working fine. What need to do is set the mysql.default_host option in php.ini to be one thing on dev, and something different on production. Unfortunately, my web host doesn't allow me to mess with php.ini.
So, what's the best way to specify a different host to mysql_connect() on dev and production. Yes, I could manually edit the variable everything I FTP, but I'd rather not.
Should I use a global variable in a separate include file? Other options?
Default Argument Values
something like this possible in PHP:
function foo($a=1, $b=2, $c=3) { //... }
foo($b=2);
Will this assign $a and $c to default values?
How To Overwrite Default Php Installation
On my linux system php seems to have been installed by default. When I type:
"which php" it tells me /usr/bin/php
I installed php and it has put an executable in the /usr/local/bin/php
"which php" still says /usr/bin/php
"whereis php" php: /etc/php.ini /usr/bin/php /usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini
/usr/local/lib/php -v shows the new version but php -v shows the old version.
How can I correct this problem?
I want to run the command php -v and it shows the newest version.
I have already tried removing /etc/php.ini /usr/bin/php
Default Value To Insert Into MySQL
What should I insert as the default value if a form field is blank? My fields don't currently accept null.
if($_POST['height']) { // error checking $height = $_POST['height']; } else { $height = ''; } Should $height be equal to '', NULL, or maybe 'NULL'? I'm thinking 'NULL' incase I or someone else decides to change the field to accept null?
PHP Session Default Timeout
what is the default Session Timeout for php...is there a way to increase this on the web server I am hostign my php scripts on..
Default Error Message
How to prevent the default error message from being displayed ?
Default Date Drop Down
Ive got the following drop down which works perfectly, although the default date is set to todays date. Could you please advise me on how to set it to show -- -- ---- instead of 31 05 2007? Code:
Php's Default Character Set
Where does it say that on php.net, that iso8859 is the default charset for strings? Can't find anything about it.
Looking For Dropdown Help
I have a dropdown in which i want it to open a soundfile when selected. So, how do I go about this. The form will get submitted, and through a series of conditional statements it will point the right selection to the right if statement. but what do I put in the if statement to get it to open a realplayer with my ram file?? Here's what I got so far. Code: <FORM ACTION="<?=$_SERVER['PHP_SELF']?mode=changedropdown?>" METHOD="POST" NAME="sermondropdown"> <P> <SELECT NAME="sermons" SIZE="1" onchange="this.form.submit();"> <OPTION VALUE="pleaseselectasermon">Please Select a Sermon <OPTION VALUE="082403Daniel_1_1-8">August 24, 2003 Daniel 1:1-8 <OPTION VALUE="083103Daniel_1_1-8">August 31, 2003 Daniel 1:1-8 </SELECT></P> </FORM>
<? if('changedropdown' == $_GET['mode']) { $selection = $_POST['sermons']; if (?Daniel_1_1-8' == $selection) { } elseif (?Daniel_1_1-8' == $selection) { } ?>
Dropdown
I have a dynamic drop down that needs to be populated from different columns in a database. The problem I'm running into is that sometimes fields do not have a value. So I would rather those didn't print out. The code below prints out the blank fields.
I know I need to loop through and check for an empty value, but I'm drawing a blank on the how part. Code:
|