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.





Html Pre-selected List Box Scrolled


Is it possible to have a list box with a pre-selected value automatically scrolled to that value when the form is loaded? i.e. if the size of the list box is 3, and the 4th value is pre-selected, I want the list box to appear starting at the 4th value in the form.




View Complete Forum Thread with Replies

Related Forum Messages:
Multiple Selected="selected" In A List.
I have a database with 1 to many and the many is a list with multiple
selects in a list. When I click on a master record I have as part of
my form the select statement for the multiple choice list. I want the
list to highlight the multiple chosen values. here is part of the
code.

$dresscat = specdresscat($dresstypeid); //this is the query to get the
values in the detail table
$drcatrow = pg_fetch_array($dresscat);// the array for the detail
table.
<select name="stages[]" multiple="multiple">
<?php
$allstages = allstages(); // this is a function to query my database
to get the value for the list.
while ($allstagerows=pg_fetch_array($allstages)) {
$eachstage= $allstagerows["stageid"];
$specstage= $drcatrow["stageid"]; // this is the point I need help
if ($specstage == $eachstage){ ?>
<option value=<?php echo $eachstage;?> selected="selected"><?php echo
allstagerows["stage"]?></option>
<?php }else{ ?>
<option value=<?php echo $eachstage;?>><?php echo
$allstagerows["stage"]?></option>
<?php
}
}
?>
</select>

View Replies !
Selected List Item Value
I know that the value for each element of my form is available through $_POST 'element_name'] but this doesn't work for lists. Can anyone tell me how I refer to the item selected in a list (combo box)?

View Replies !
How Do You Do Selected In A Multi-value List Box In A Form?
I am populating a list box from a dictionary table and then picking
muliple values to insert into a detail table. How do I get the list box
to have multiple selections highlighted when I pick one of the master
items?

View Replies !
List All But Echo In Checkbox Only Selected
There is a 3 table: I want to list all the product groups but to be checked in checkbox only what choose the user.

If from outside (choos.php?tt_reg_id=1) user is nr 1 then in listed checkboxes need to be checked only those checkboxes what the user nr 1 choose / but listed the all product groups. Code:

View Replies !
Best Way To Show Selected Option In List Box
I need a way so that we can show selected option in list box without using if condition in loop since some times we have lot of options and we have too much if conditions to check.

View Replies !
User Selected Order Of List
My experience in php and mysql is just copying and pasting freebie scripts- very limited.
I'm wanting to create or better yet find another freebie script which will in my real estate site on the page with a table listing properties with headings such as
date/ type/beds/baths/price etc.

users be able to click on a heading which will then list the properties according to the selected heading, so if they choose 'type', the page will refresh and show all houses or land or apartments according to type grouped together and so on. First I think I need to have a link on the heading buttons to activate a php script which will send info to mysql database and if the database is configured right through the admin area it will respond accordingly. But what php script? How complicated could it be?

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 !
Session Variable To Pass The Id Selected From A List?
I have a list which the user can select from in order to go to another page with details of the selection. I currently have the id of the selection being passed on the link as follows: PHP Code:

View Replies !
Transferring The Selected Record From The List Box To Textbox
Breifly, I've 3 list boxes.Select a record from the first one, click a button, the second list box is filled and select a record now and then click a button, the third list box is filled.Now, select the record, the selected record has to be shown in the text box.But, I also want to show one more field related to this one in another text box.How can i do??

well, the first list box shows the topic names, 2nd one the sub-topic names and the third one the article names. Now, when i select the article name, the article name and the article content has to be shown in the text boxes.

If its just article name, i know how to do it by java-script but i also need article content to be shown. Could somebody please help me how should i modify my code and where should i insert the text boxes?? Also, one more question, If i make any changes to the data in the text boxes, i would like to update.How can i do that?? PHP Code:

View Replies !
Combo/list Box Showing Values Selected
I have a combo box being populated dynamically through php using a mysql database, and everything works fine.

My question is: How would i make it keep the values selected, once the user hits the submit button? For example, let's say i have a combo box with the values 1 2 3 4 5 in it. The user selects &#393;' and hits the submit button (which posts to the same page). At that point, i'd like the combo box to still have &#393;' selected, instead of resetting itself.

View Replies !
Populating Drop Down List With Selected Vaue
I have a drop down box and the "selected" value needs to be selected by a dynamic value that gets entered into the database, this is currently how im doing it: PHP Code:

<?php
                if($modify_row[21] == "0") {
                  print "<option value=" "></option>";
                  print "<option value="1">Active</option>";
                  print "<option value="0" selected>In-Active</option>";
                } elseif ($modify_row[21] == "1") {
                  print "<option value=" "></option>";
                  print "<option value="1" selected>Active</option>";

Its fairly straight forward, basically the option that is automatically selected needs to be the one coming from the database $modify_row[21].

View Replies !
List Box In Form Returns Index Number Not Value Of Selected Item
I have a form that contains a list box that is filled by an array. When the form is submitted, it returns the index number of the selected item of the array of items in the list box, not the value. The value is what I need, not the index number of the selected item. Code:

View Replies !
Using Pre-selected Template To Generate Html Output.
When I select an image html page, the script scans for %% identifiers and creates the appropriate thumbnail size with an html gallery page for it. The problem is the html gallery. I'm trying to use the image html page as the output, not a default template from $str. Code:

View Replies !
How Do I Change The Drop Down List So The Option Selected Last Time Is Then The Current One Shown In The Drop Down Box?
I have a drop down list with the town options 'Bury' and 'Ipswich' as
shown below.

When selecting one of the options, its value is passed to variable
$townsearch.

How do I change the drop down list so the option selected last time is
then the current one shown in the drop down box?

<body>

<?php $townsearch = $_get['town']; ?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">

<select size="1" name="town">

<option>ipswich</option>
<option>bury</option>
&nbsp;
</select>&nbsp;

<input type="submit" value="GO" />

</form>

View Replies !
Make Selected Option Stay Selected In A Combo After Submit
I have 3 comboboxes, one for the day, other for the month and another one for the year. Every time i select a value for the three of them and press the "Submit" button, they reset to the default option. Anyway this can be solved?

View Replies !
Detect What Option The User Selected And Then Direct That User To The Selected Page.
Quick question regarding HTML forms and select fields. I want to be able to detect what option the user selected and then direct that user to the selected page.

<select>
<option name="1">1.html</option>
<option name="2">2.html</option>
</select>

when the user selects, 1.html, it'll direct them to http://www.domain.com/1.html same with 2.html. I wasn't sure if this was done with PHP or Javascript, if its possible on both, which is better?

View Replies !
How To Create Html List From Such Array ?
I've got an example array like this:

$myArr = array(
array("jj", "0", "jjj"),
array("ee", "0", "eee"),
array("bb", "ee", "bbb"),
array("ll", "ee", "lll"),
array("ff", "0", "fff"),
)

Where each row is an array with columns: id of list element, id of parent
list element ("0" means main node) and content of the element. So, from my
array I'd like to create a list like this:

<ul>
<li>jjj</li>
<li>eee
<ul>
<li>bbb</li>
<li>eee</li>
</ul>
</li>
<li>fff</li>
<ul>

View Replies !
Generate A Random List Within My HTML
I'm trying to generate a random list within my HTML. I've done random lists before, but this is giving me problems.

In the code below, $file should be printing the array I have stored in $file.  $file contains raw HTML, comprised of about 10 items right now, but will be higher as I add to it.  (That is why I did the $arraycount).

I did a var_dump($file) and I can see that $file does indeed contain what I want it to, but I just cannot get the contents into my page. Code:

View Replies !
HTML 'list/menu' And PHP/mysql
tell me the correct syntax to use for assigning the selected option from a pick-list before inserting to a mysql database? I am trying to give the visitor the option of some 20-30 categories from a pick-list and then I want to store the selected category in a field (called 'cat') in my mysql table.

View Replies !
List All The Links From An Html Page?
Is there a way to list all the links from an html page?

View Replies !
Multidimentional Array To Html List
how do i convert a multidimentional array:

Array (
[option 1],
[option 2] => Array ( [option 2 - part 1] => Array ( [Temp], [Temp 2])),
[option 3])

To a html list that looks like this: HTML Code:

View Replies !
How To List/find Html Tags In Text
What I try to do is to search a text for html tags.

Why. Because I want to use nl2br on the text, but since this command add
br instead of all /n it is not a nice thing to add t.x. a html list inside
the text. Of course it is possible to add the list and remove all space
between li tags, but this is not so readable to the writer.

What I try to do is also to add nl only in the plain text and inside li
and td tags. So in the li case I have to find <ul> and </ul> and <table>..

View Replies !
List Of Sybmols Like To Display > On Html Page &gt And Which Are Others
i am making an application.

the user can give description and that description is stored in
database and then the description is shown on html page.

suppose the user has written "<b>hello</b>" in description then in the
database the following will be stored "<b>hello</b>" but when i display
it on database the hello in bold letter will be displayed.

i know the soultion that i have to replace the occurrences of < with
&lt and occurrences of > with &gt but i don't know that which are other
symbols which needs some repair like above so please give me a list of
html symbols and their equivalent symbol.

View Replies !
Reading HTML Unordered List Into Multidimensional Array
I have some software (Wordpress, actually) that is sending HTML code of an unordered list when I call a particular function. I want to make that list into a multidimensional array. So something like this: Code:

View Replies !
Send An Html Page To People On A Mailing List.
I am wanting to be able to send an html page to people on a mailing list. I have set it up so it sends $mailing_template which sends an html page.

Only, when it reaches the inbox it shows as straight html (un parsed) and not as the page. How can I set it to send it as HTML and not straight HTML code please?

View Replies !
How I Can Make A List That Acts Like A Html Jump Menu?
how I can make a list that acts like a html jump menu (for a regular list I have to use a "Go" button in order to achieve the desired behaviour and jump menus I cannot use because they work only with links to other pages).

For example,I want such a list filled with questions from my db and when I select one I want to see its possible answers; the page stays the same, only its data differs based on the selection. Or you can have a look at such a jump menu on this website, the one with options for geting to various sections of the forum.

View Replies !
List All The HTML Or PHP3 Or TXT Files In A Variable-defined Directory
What I need to be able to do is to list all the HTML or PHP3 or TXT files in a variable-defined directory, with a little icon next to each one and each one needs to be able to carry a link. Anyone got any ideas as to how to do that? The link that needs to be carried will contain the name of the file.

View Replies !
How Can Strip The Text Bullet And Then Make That Copy An Unordered List In The HTML?
I have some text coming into a web page from a MySql DB that contains bullets in the copy. The copy cannot be changed as it is also used in a Quark Xpress document we have connected to the DB. So, my question is how can strip the text bullet and then make that copy an Unordered list in the HTML?

This is what I have but and does the indents like a list but no bullets (I guess they are being stripped by the str_replace as well?

echo str_replace(Chr(13), "<p>", ("<ul>".str_replace('•', '', $bulletcontent1)."</ul>"));

View Replies !
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and
when people click one item, we will refresh the same page with the
product name as parameter, and in turn we want to include a HTML file
into the content area of the same page.

I know it is recommended to put everything into database, but we want
the web site to be very "portable", so the drop-downlist and the
content should both in text files.

Let's say the drop-down list will be poplulated from the product.txt
file, and there will be a file for each corresponding item in the
drop-down list. From the user point of view, if he wants to add a new
product, he will just need to open the product.txt file, and add a new
line with the product name, "Laptop", then add a new text file named
"laptop" in the same folder which contains the HTML fragment to be
included in the content area.

What is the easiest way to do this?

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

View Replies !
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 = &#391;') 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?

View Replies !
Produce A List Of Tables Currently Within My Database And List Them In A Drop Down Box.
I need to produce a list of tables currently within my database and list them in a drop down box.

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

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

View Replies !
Selected Value
Trying to get the below to have the SELECTED value chosen but it is not working. What am I doing wrong?

while ( $buyerline= mysql_fetch_array($getresult, MYSQL_ASSOC))
{
print "<option value='$buyerline[id]'".($buyerline[id]=='$buyer'?' SELECTED':'').">$buyerline[buyer]</option>
";
}
print '</select>'

View Replies !
$selected
I'm trying to generate a select box through php. the problem comes when I try to dynamically add in the 'selected' attribute to one of the options. My script is basically the following: Code:

foreach($values as $key => $value) {
if ($key == $checkVar) { $selected = ' SELECTED' } else { $selected = '' }
$options .= '<option value="'.$key.'"'.$selected.'>'.$value.'</option>'
}
print '<select>'.$options.'</select>'

View Replies !
Selected Box Action
how to set the respond to action when user choose an option inside a <select></select> box? eg. when user select an option in the <select> box then php search for data inside mysql and then display the required data on the <input type=text>.

View Replies !
Php Dropdown - Selected?
i'm using this to pull information from a database and display it in a dropdown list. The problem is I am using the name code when I goto the "Update" page, but i'm not sure how to add the "selected" field, that way what ever I saved in the database will load.

Example: I goto add and it add's the "id" of 7 to the field, when I load the page again it auto's back to 1 instead of clicking in-to 7 as thats whats already there... = ) Code:

View Replies !
Know Out Of All Checkboxes How Many R Selected And Which Are They?
i have a checkbox array of some unknown size.its a dynamic array created.
i want to know out of all checkboxes how many r selected and which are they?
and then insert the data in the table based on that. i hav written the code as follows:-

<?
$no=0;
$friendname= $_POST['friendname'];
$storecount=$_POST['storeid'];
while($no<$storecount)
{
   if($friendname[$no])
   {
      $sql = "INSERT INTO groupfriends (groupid, username) VALUES ('$stid[$no]', '$friendname[$no]')";

      $result = mysql_query($sql) or die('Query

failed. ' . mysql_error());
   }
   $no=$no+1;
}
?>

i dont think this will work.it will add all the checkoxes data to the table. i want to insert only of those which r selected.

View Replies !
Remember Selected
How does a script remember selected qty when the user needs to edit an order form.

echo"<select name ='blar'>";
for($num;$num<$num2;$num++)
{
echo"<option value = '$num'";

........................... // here needs to be selected = 'selected' at the correct place??

echo">$num</option>";....

View Replies !
Selected Combo Box
i have the following code and i am having problems with setting the combox to select the value that is stored in the database. i am hoping that the combo box selects the value and the value from the database is stored in $title PHP Code:

<?php
function displayedit($id,$title,$fn,$ln,$instit,$depart,$email,$url,$room,$phone) {  
echo '
  <form name="editform" method="post" action="editform.php">

  <p class="body"><b>Title:</b>'

    $t ="Dr","Professor","Mr", "Ms"
    echo "<select name='selectTitle'>";
    foreach ($t as $value) {
     echo "<option value="$tvalue"";

View Replies !
No Database Selected
Im running twice the same website:

- one for the public
- one for private testing

Everything is moreless the same, except some config variables in the php and the replacement of css directories. However on the test server im getting a no database selected:

mysql_query('sqlhere') doesnt work
mysql_query('sqlhere',$conn) does work

So somehow on my test server it is not taking the only open connection, but wants it specified. Code:

View Replies !
Selected In A Drop Down
I have two drop down menus. First one is location. When you change location page refreshes and comes with the selected area. So with the refresh,the second drop down changes to the sub-locations of the selected location. For example: Here is my code:

<?php
if ( ! isset($location) ) {
$location="Bodrum";
}
@mysql_connect ( "localhost", "root", "passwd" ) || die ("MySQL'e baglanamadim");
mysql_select_db ( "ceyhun" ) || die ("Veritabanýný seçemedim");
$sorgu=mysql_query("Select *from locations");
$sorgu2=mysql_query("Select *from sublocations where Location='$location'");
?>
........

View Replies !
Remember Selected Value DropDown
I am attempting to have a drop down menu that displays url from 1 table called links the same table also contains a name for the url. i.e. google.com = name and http://www.google.com = url The value of just the url from links is stored in a separate table called users in a field named search after form is submitted by user. Everything Posts correctly except when go back to edit the record and submit the form the drop down box does not retain the value of what had been previously selected although it is the correct record until form is updated when whatever value is currently in the drop down list will update the record.

I know the code is doing exactly what it is told to do, because I have no functionality in it to recall the value from the field search in the users table. I don't know if it is something I would have to add to the array or option value. I can get it to work if it is all hard coded, but I am attempting not to do this. I am pretty new to php mysql and any help is greatly appreciated.

This is the code I am working with that came mostly from a tutorial. PHP Code:

View Replies !
How To Give A Value To Non Selected Checkbox
I would like to get a value for a non selected checkbox in a form.

Imagine my form contains :

<input type='checkbox' name='t[0]' value=&#391;'>
<input type='checkbox' name='t[1]' value=&#391;'>

When I analyse $t, if first checkbox is not selected and second is, I have :
$t[0] has no value. $t[1] equals 1
and count($t) equals 1

I would like to find a way to get :
$t[0] equals 0. $t[1] equals 1
and count($t) equals 2

View Replies !
Resize Only Selected Images
I have an image upload script that is resizing every image that a user uploads.
What I would like to do is have a check box added to the upload form that a user can check to resize the image if they want to or leave it unchecked to just upload the image.

So if the box is checked the original image gets uploaded and a resized image is created as well If the box is not checked just the original image uploaded. I tried adding a check box but every image still was resized - checked or not - Im assiming because it was in the foreach loop so I dont know what to do. Code:

View Replies !
PHP And A Pre-selected Option In A Form
I've got a little text editor thing on my site, and to open a file, you input the file name and choose the folder from a drop-down list and click the Open button. The default filename is "index" and that file keeps track of all the files contained in that folder. It works okay. What's annoying is that regardless of what folder you're messing around in, the drop down list always goes back to showing the default folder name as the page is reloaded. I want it to be preselected to the folder it's in.

It seems simple enough--the folder you're in is $_GET['dir']. But I've read some HTML form how-tos, and I can only see that you can preselect using the tabindex="" or selected attribute.

View Replies !
Radio Button Selected
What I wish to do is have a radio button pre-selected depending on what is pulled from the database.

For example if I had 2 radio buttons:

o Yes o No

One has the value 1 and the other has the value 0

If 1 is selected from the database then Yes is pre-selected, else 0 is pre-selected. How would I do this?

View Replies !
Setting Selected Option Using PHP
I have a drop down list which I want to be set to what was selected when the form is submitted. As the form is processed by the same page, it returns to the preset default. How would I go about making this selection box set the option selected on the next page?

View Replies !
Randomly Selected Account
I have an application that I need users to be logged into automatically without creating an id. I have setup a database with users names as user1, user2, user3, and so on, and a field called in_use. I can make php set the in_use field in the database to yes when the page is loaded and I can get php to select the first available username. I can't however get the database to reset the in_use field by itself (if the user closes the window insted of clicking log out).

View Replies !
Display The Selected Checkbox Id
I created a list of check box,if i select a indvidual check box,then it must go to the indvidual pages on the basis of selection. how to code for this.

View Replies !
Want To Add A Re-direct When Submit Is Selected
I'm using this Upload script and would simply like to re-direct the User, after he's Uploaded, to a different location. I don't know where/how to do it? Code:

View Replies !

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