Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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.




View Complete Forum Thread with Replies

Related Forum Messages:
Setting Default For A Dropdown
I use this bit of code to create a dropdown menu for the number of days in a month: PHP Code:

<?

for ($day=0; $day<=31; $day++) {
    echo "<option value="$day">$day</option>
";
}
?>

I want to set the default value to "14" though. How can I do that?

View Replies !
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 Replies !
Dropdown List Selected By Default?
Does any one know how to have an item in the dropdown list selected by default?

$city_field = HTML_QuickForm::createElement('autocomplete', 'city', 'City', $cities);

$cities is an array of city names and I would like, say 'Los Angeles' selected by default.

View Replies !
Dynamically Selecting Default From Dropdown
I have a dropdown menu with 17 options that I want to use to edit a mysql entry. Before I edit it though I want to load the value of that particular mysql column as the pre-selected value in the drop down. Whats the best way to accomplish this. I figured I could write 17 if than statements but thats seems a bit tidious especially if I have more then 17 options. I'd preffer to have the code written out for the options and just add in the selected statement if possible. PHP Code:

<select name="country" id="country">
                <option value="1">CAN</option>
                <option value="2">USA</option>
                <option value="3">RUS</option>
                <option value="4">CZE</option>
</select>

If the result for country = 1 I'd like to add the selected code to the option.

View Replies !
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:

View Replies !
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???

View Replies !
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.

View Replies !
Default Value
I use mysql 4. The table is

create table a(
first_name varhar NOT NULL default 'defaultname'
)

When I insert into the table
insert into a values('');

The value is NULL not 'defaultname' What am I doing wrong?

View Replies !
Add Default From
I have tried to add a default sender address for my php mail scripts so i dont have to add it on a per script basis. I have access to the php.ini and i have tried two settings.

sendmail_path = "sendmail -t -i webmaster@mydomain.dk"
sendmail_path = "sendmail -t -i -f webmaster@mydomain.dk"

View Replies !
Default Id
I am passing the id parameter through the url, however i want to add a piece of code that permits me to assign a default id value if no value has been passed in the url.

<?php $id=$_GET['id']; ?>

If that is null then $id=25; //

View Replies !
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?

View Replies !
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?

View Replies !
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.

View Replies !
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";

View Replies !
DEFAULT Switch?
This code works if the IP address is a match, BUT if it is not a match why does this code not use the DEFAULT switch? Code:

View Replies !
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;

View Replies !
Default 2147483647
I am doing portal for storing info of visitors.it is working well too.but my prob is with mysql..when i entered infoa bt thier phone numbers ,fax or mobile numbers,soemtimes it is storing 2147483547 instead of given number or default null.can u tell me the reason and solution for it.

View Replies !
Default Charset
When not specifying the charset in a php script, which one is used by default? A php server seems to have a default charset setting (see phpinfo below of my host's server).
Code:

php core
default_charsetno value

Apache Environment
HTTP_ACCEPT_CHARSET ISO-8859-1,utf-8;q=0.7,*;q=0.7

HTTP Headers Information
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7

HTTP Headers Information
Content-Type text/html; charset=iso-8859-1

Though this one seems to have a default charset setting of none, does the http headers information mean that any website or php script accessed with the browser's address bar gets a iso 8859-1 by default anyway?

View Replies !
Set Default Value To The Same Value As Another Field
Basically I have a 'Date Entered' field, which defaults to the timestamp of the date a new record is entered.

I also have a 'Last Updated' field - so when a new record is added, these would be the same - so would like 'Last Updated' to default to 'Date Entered'.

I've tried just entering 'DateAdded' or "DateAdded" as the default in phpMyAdmin, but it doesn't like it.

View Replies !
Default To NULL
table product

products_id, products_name, icon_1, icon_2.

table icon

icons_id, icons_name

When I display a product, I may display some icons (0-2) with that product. So I have the above produc and icon table set up. In the product table, icon_1 and icon_2 will hold the icons_id from table icon, if there is an icon at that position.

icons_id is smallint (Auto Increment key value).

To me it is the same. Both value will never be the icons_id of table icon, which will mean no icon will be shown.

What is your suggestion? In general, in this case, the samillint value will not be used in any calculation, only will be used to refer to another tables auto increment key. When it is EMPTY, should I set it to 0 or should I set it to NULL?

View Replies !
Default Timezone
How do I set the default timezone to Eastern Standard Time? I am displaying the time on one of my pages but it's five hours off of my time so I'm guessing it's england's time.

View Replies !
Set Default Value To Value Of Other Field?
Can I have a table something like this:

COL A
COL B
COL C

where COL B's default value (if none is inserted) is the value entered in COL A?

View Replies !
Set Default Date
i want to set defult date in my date list(eg current date by defult in the list menu of- day,month,year)in php .

View Replies !
Default Select Tag
I have a config file editor page that should read the config file, then automatically select a <option> from a <select> tag. I dont want to have to write an if-else statement for each line in the config file(there are over 200)and I came up with 2 ways to do this and was wondering which would be easier and less cpu intensive.

1) Create a loop for each config option, and check on each step in the loop for what should be 'selected' by default. 2) Make a function to check. EX:

(checkifset prints out selected="selected")

<option other stuff checkifset('config_option','value1'); >Value 1</option>
<option other stuff checkifset('config_option','value2'); >Value 2</option>
<option other stuff checkifset('config_option','value3'); >Value 3</option>

It seems that option 2 would be easier to code(since I already have the html coded out), but it may also be more cpu intensive.

View Replies !
Retrive Default Value
How do I retrive the default value of a column? (I mean the deafult value you can specify when you create your table and that is assigned if you create a record without supplying data for that column).

View Replies !
Php Default Directory
I've installed Apache, PhP 5.1 and MySql. Which is the default directory where I can test my Php scripts?

View Replies !
How Can You Set A Default Checkbox Value?
How can you set a default checkbox value? I'm not sure what toggles it on and off or checked and unchecked. Yes i'm new at all this. But I'm learning well. What i need to go is query my database and if the value isset i want the checkbox to be checked, othewise unchecked.

View Replies !
Default Html
have some input boxes and few buttons. On that page if user hits ENTER key at any time, it will have a specific to be defaulted to invoke [like default=true of Command Button in Visual Basic]. Is same effect possible in HTML?

View Replies !
Default Value In Php Script
I like to my members to be able to include audio and video on their profile page. The EDIT PROFILE page has the following code where the member can enter the audio/video info:

      $audio = "<textarea name='audio' class='text' cols='45' rows='3'>".stripslashes($row["cAudio"])."</textarea>";      
      $video = "<textarea name='video' class='text' cols='45' rows='3'>".stripslashes($row["cVideo"])."</textarea>";

I like to have a default audio and video file which are used if the member do not change the default values above.

View Replies !
Passing A Default Value
I want to have the customer select a link based on a choice of options and go to a customization page where their choice is now the default value in a dropdown menu.

View Replies !
Default Parameter
If possible, how do I use a function to create a default parameter
value? The following gives me an "unexpected '(', expecting ')'"
error, which makes sense.

function DisplayInfo($ID, $startdate=date("Ydm"), $numdays=7) {
...function here...
}

View Replies !
Arrays, Default?
i dont know if you can but i need a custom default value for every element in an array each element isnt created yet, but i need a way of making it so every new element in

$error_array = noformat

but obviously that dosent work, i ve tried it.

View Replies !
Int Default NULL And O?
What is the difference for "int" type if default is NULL or o?

View Replies !
Default Value For Get Variable?
basically i want to set a default value for this variable, which is to be replaced by the new GET variable the user submits, is there anyway to do that?

it seems when i define a variable in the php script, it doesn't get replaced by the values i give via GET simulation (just adding?var=value) to the end of the url.

View Replies !
Default Php Extensions
if phpize needs to be run for default php extensions. by default i mean the extensions that are included in the /ext directory when you unpack the php source code. i've run phpize for a custom extension i'm trying to use (php-ffmpeg), but i'm having a lot of problems right now with configure and make process.


View Replies !
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.

View Replies !
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)

View Replies !
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:

View Replies !
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?

View Replies !
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......

View Replies !
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;
}
}

View Replies !
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:

View Replies !
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?

View Replies !
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?

View Replies !
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

View Replies !
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?

View Replies !
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..

View Replies !
Default Error Message
How to prevent the default error message from being  displayed ?

View Replies !
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:

View Replies !
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.

View Replies !
Display A Default Image?
Is there an "if" statement I can use to check if an image exists in a certain directory, and if it does display it, but if it doesn't exist then display another image in a different directory? I've written simple "if" statements for text display, but nothing like this. Is this possible?

It might help to tell the scenario. I am putting together templates for teacher web sites. If they wish, they can upload their own logo into their upload directory to display at the top of the page, but if they choose not to upload their own logo I want the default (district) logo to appear there. The default logo is located in another directory on the same server.

View Replies !
Default Install Directory
I know the default is /usr/local...however, if the --prefix= flag is not used, does make create a seperate php directory (i.e. /usr/local/php) under which everything is installed? Or is everything dumped into /usr/local?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved