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




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.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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 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 ?

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>'."
";
?>

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?

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.

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.

Drop-down Menus
How can I create drop-down menus 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:

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.

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?

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:

Using PHP To Pull From MS Access DB
I've been trying to create a simple (I hope) PHP application to send
emails to a membership list. I have yet to successfully connect to my
database to pull the names and email addresses. I'm running XP Pro,
PHP Version 4.3.2, Access 2000. I have created an ODBC System DNS
connection to the database file I want to access, And I get this error:

Warning: SQL error: , SQL state 00000 in SQLConnect in connecttodb.php
on line 2
Whoops! Could Not Connect to ODBC Database!

Here is my code:

<?php
$odbc = odbc_connect ('DFWMembershipDB', '', '') or die('Whoops! Could
Not Connect to ODBC Database!');
?>

Database Pull
im having a problem getting this syntax to work properly what i am trying to do is display the top 15 songs and when u scrollover the links of the song names that are pulled from the db it shows a title that displays there first and last name along with price pop and album name. all of these are in the same table except for firstName and lastName these are in the customer table. Code:

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 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:

Insert Date Using Drop Down Menus
I know how to insert a date by filling in a field but I don't know how to do it using a drop down menu. One menu being month, another the day and the last the year. Any code snipplets I can disect and play with or tutorials on this?

Drop Down Menus And Mysql Insertion
I'm looking to create drop down boxes for a user to select the date and then have it insert what they select for month, day, year, hour, minutes and insert it into mysql. It needs to be organized in a timestamp like so: 2007-02-28 21:06:40

I've created the drop down boxes and it works pretty well: Code:

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?

Pull Data Out Off Mysql
I am making a database using mysql where i have 2 tables, one for car manufacturers and one for car models.I've already done that. I have made a php page where i have 2 drop down menus.

The first menu shows car makers(manufacturers) and the 2nd nothing. Now when a user opens the 1st menu and selects a maker , the 2nd automatically fills up with models from that car maker only and it gets its information from the database.That is every time i decide to add a new model to my database the 2nd menu (if selected) must go and search the database for all the models for that maker and show them. Code:

Pull Variables From Mysql
how I can pull a specific query from a mysql database and store it in a php variable. how can i go about doing this?

Pull Document Out Of MySQL
I am trying to pull documents into a page using php.  The documents are stored in a mysql database.  The page works when I link to it from within a page, but when I try to drop the link in and go directly to the page, it tells me the document cannot be found.  This page requires a login, and I have tried logging in first to see if it makes a difference.

It works in Safari and Firefox when I paste the link in, but not Internet Explorer. I know this is a weird one and I am not sure whether or not to put this in the php forum or mysql, but I really appreciate any help any of you can give on this one. Code:

Pull Information Off An Anchor ID
I have a bunch of links that ref is the same page.  Is there any way on that second page I can tell which link was clicked if my links are structured as:

<html>
<a href="page.php" id="link1">Link 1</a>
<a href="page.php" id="link2">Link 2</a>
<a href="page.php" id="link3">Link 3</a>
<a href="page.php" id="link4">Link 4</a>

Pull 1 Number From An Array
I'm trying to set an array of a series of 6 single or double digit part numbers and match it against a user input selection of part numbers.  For example, if the user is looking for part numbers 10,9,43,7,6 from an item that has part numbers 10,14,16,31,43,50 then it would highlight that part numbers 10 and 43 are a match, but so far it's only highlighting 1. Code:

Multiple Table Pull
$result = mysql_query("SELECT $tb1.fname FROM $tb1, $tb4 WHERE $tb1.email = '$T1' AND $tb1.pass = '$T2' AND $tb1.unum=$tb4.unum",$db) or die(mysql_error());
$_SESSION['myfname'] = mysql_result($result,0,"$fname");

The error I get is:

Warning: mysql_result() [function.mysql-result]: not found in MySQL result index 6 in /home/xratedda/public_html/loginout.php on line 39

I know, it looks like I am only grabbing one thing and don't need different tables, but I am trying to figure out how to do this with just one item, before adding the rest.

Connecting Two Database Populated Select Menus
I am able to grab the data from the database to populate the menus individually using.
PHP Code:

Values Into Radio/check And Drop Down Menus
I am attempting to create an update form where the current fields in the table are populated into input boxes and then can be altered where necessary.

I was wondering if it is possible to pre check radio buttons, check boxes and pre populate drop down menus based on the results currently in the table. eg. if the gender of a person is male then the radio button will be pre checked as male. How would this be done.?

Script To Pull Pagerank Code?
I will be gooogling next but hopefully I can use this as abackup. Does anyone have any good free scripts to pull the PR value and display it on a website?

How Do You Pull Specific Characters In From A $string
I want to create a method that will tell me the 10th and 11th character
in a string, and store it as $something. How can this be done?


Session Info And Pull Down Lists
i have a html pull down list (<SELECT etc etc <OPTION VALUE .....) and
i have the particular value the user last chose it to be in a
$_SESSION['value']. How do i set the selected item of the list to this
one? I can just add it in as the selected item of the list but then it
appears twice.

My Host Has NO PHP, Pull This Data From Another Server
I'm wondering if anyone here can point me in the right direction. My host
does not provide php, and so I need to pull this data from another server
that does support such scripting.

Automatically Populate A Pull Down List...
What I want to do is have 2 pull down lists, for example a state pull
down list and a city pull down list. What I would like to have done is
when you select a state from the state pull down list then the city
pull down list will populate with all the cities from that selected
state. I know that is a lot of data but that is just an example. Or
something like when you are looking up cars online they have a make
pull down list and a model pull down list, and when you select the make
it will populate the model pull down list with all the models from that
make.

How To Pull Only Unique Items From Database?
I have a table like this: date, author, title, content

now I want to grab the 3 latest items from this table from 3 DIFFERENT authors.

I want this:
-article by jim
-article by sally
-article by john

Not this:
-article by jim
-article by jim
-article by sally

even if the two latest articles happen to be by jim, lets only grab the first one and move on.

So basically I need (in pseudo-sql/plaintext):
select title from contenttable where author=unique order by date limit 3

I've got everything code-wise except the "author=unique" part, how do I do that?

Automatically Populate A Pull Down List...
What I want to do is have 2 pull down lists, for example a state pull
down list and a city pull down list. What I would like to have done is
when you select a state from the state pull down list then the city
pull down list will populate with all the cities from that selected
state. I know that is a lot of data but that is just an example. Or
something like when you are looking up cars online they have a make
pull down list and a model pull down list, and when you select the make
it will populate the model pull down list with all the models from that
make.

Use Multiple Proxies To Pull Content
I would like to do something like below but am afraid the hosts i am getting info from will ban requests from my url.

$url = "www.myspace.com/". getUserName($userID);
$content=file_get_contents($url ,FALSE,NULL);
//parse html and store some parts in a database.

Do you think a site like myspace will give a poop about lil' old me and ban requests from my server? The requests are user initated, and will only parse their webpage. So im not doing anything evil here.

Just worried when I run requests everynight, they will see a flood of requests from 1 server and ban the IP. Is there anyway to get http information through various trustable proxies and what functions should i check out?

CURL To Pull Data From A Site
I've been using php and cURL to pull data from a site, and things worked just fine. however, when i used the same script to access a different site, not data is being returned. however, i can go to the url of the site being used and there is clearly html there which should theoretically be scraped. any idea why it is not being gathered and how can i fix this?

Using A Loop To Pull Data From Mysql Recordset
This has set me back a couple of days now and I could really use some
help or at least a shove in the right direction.

What I'm trying to do is list reviews in a database on a page, by
artist (byartist.php). The first step is pulling each artist and
listing them alphabetically. If the artist has more than one album
reviewed, they should still only show up once, so I need to check each
row of the recordset, and check the artistname against a variable or
something, and if it exists, to just skip it and move on to the next row.
Then I need to list the albums reviewed under each respective artists
name and use them as links with url parameters to the respective review
pages.

I've got the recordset down per some advice from another newsgroup, and
I'm fairly certain its correct for what I need to do.
<?php require_once('conntest.php'); ?>
<?php
mysql_select_db($database_test, $test);
$query_byartist = "select artists.artistid, artists.artistname,
areviews.albumid, areviews.atitle from artists join areviews on
artists.artistid = areviews.artistid";
$byartist = mysql_query($query_byartist, $test) or die(mysql_error());
$row_byartist = mysql_fetch_assoc($byartist);
$totalRows_byartist = mysql_num_rows($byartist);
?>

The php example I was given for pulling the results was kind of
half-effort and not enough for me to really see what was going on,
understand it and build upon it. I'm (obviously) just starting out with
php/mysql and I'm pretty good at building upon something in front of me
and figuring it out, just need a little help because I've tried it over
and over and to no avail, I wind up with syntax errors.
Sorry for the wordy post, I didnt want to skimp. Thanks for any help or
advice or any points in the right direction. I've got about 3 days of
progress to catch up on

How To Pull 1 Line Of Data From A File? NO MYSQL
I have this file that has 2 lines in it. Heres how the files looks.

file: fbddata.lbn

line1:uncle1234562
line2:

As you can see, on line 2 there is actually no data but the file still seems to have a 2 lines. But when I pull the info from the file using the "include" or "require" command it just pulls the 1st line of data. BUT..when I try to use the "include" or "require" php commend within a HTML link code like this....

<a herf="www.mysite.com/Lavishphpfreak/<?php include("fbddata.lbn" ?>/ilovephp.php>LINK[/url]

it gives me a link that this...

http://www.mysite.com/Lavishphpfreak/uncle1234562
/ilovephp.php

now did you notice the code that was added to the link. I have figured out that its doing this because of the blank line 2 thats in the fbddata.lbn im trying to pull the data from. Of course the easy way to fix this would be to just go into the file and delete the blank like 2 but i can't do this because i dont have permission to edit the file. Its created using "root".

So does anyone know of a php code that will just pull the 1st line of data from within a file. I can't use mysql cause this is NOT in a database..and plus I haven't advanced to databases yet.

How To Pull Existing Title Tag Into The Body Of The Document As Textonly
I need to be able to pull the current <Title> tag from the header into
the body of the html page. We started coding this with php, and we
were able to get it working. However the entire page is being parsed
and really bogging down the system and the pages load very slowly.
(the system is Dual P4 2.4, 1GB ram, Redhat 9.0)
To fix this we decided to just use javascript, which worked great.
Text loaded immediately. However, search engines will not process the
javascript, thus this text will not be available in the document to be
scanned.
Does anyone have a way to pull a title tag from a document and display
its content as text only within a document, Without loading down the
system? When we tried it, it took the pages at least 5 times longer to
load than without the code.

Strpos To Find Xml Tags To Pull Out The Text Data
I'm trying to use strpos to find these xml tags so I can pull out the text data; but the bracket chars won't let the function work. Is there another way to do this?

$php_XML_tag = "<codeFacility>ZNY</codeFacility>";
$pos = strpos($php_XML_tag, '<codeFacility>');
print $pos;

results is $pos == 0

Form Processing: Change The "action=" Based On Pull Down Menu
I have an html form for that uses username and password to login to a
specific area of the website. The "area" the user wants to go to is
based on a pull down menu. Becasue the user/password info is in
differnet databases, how can I call different validation scripts based
on this input ?

See below please. Somethinglike this:

form.html:
<form name="loginform" method="post" action="login.php">
<select name="loginform">
<option value="one">Section 1</option>
<option value="two">Section 2</option>
</select>

login.php:

@extract($_POST);
if($_POST[loginform] == "one") {

echo "action = /forums/scc/dispatch.cgi/_admin/AVFLogin"
NAME="LoginForm" >
echo "<input type=hidden name="autologin" value="1">
";
echo "<input type=hidden name="formstyle" value="standard">
";
echo "<input type=hidden name="returnforum" value="_admin">
";
echo "<input type=hidden name="returnmsg"
value="acahomepage">
";

} else {

echo "action = /path to different cgi
";
echo :different values for hidden fields".

}

Dynamic Nav Bar
I am trying to implement a dynamic navigation bar. My problem is as follows -

All of my scripts are located in various folders, and as you move to different areas of the site, the links to the other areas of the site will change. For example, I am currently at home.php and the nav bar has references to admin/manage_users.php and companies/view_employees.php, etc etc. If I go to manage_users.php, I am now executing a script in the admin folder. The nav bar still has a reference to companies/view_employees.php, which would make this a dead link.

There are lots and lots of directories and subdirectories that one can navigate to, so I don't want to have to write code for a nav bar every time. Is there something like $_SERVER['DOCUMENT_ROOT'] that I can use that will help?

Dynamic Variables In Php?
Hi,
I have a mySQL table that contains two columns
column one is 'feature' and column two is 'feature_value' - some of the data is for example

'hair_color' - 'blue'
'hair_color' - 'blonde'
'hair_color' - 'black'
'hair_color' - 'gray'

'eye_color' - 'blue'
'eye_color' - 'hazel'
'eye_color' - 'brown'

Yeah I know... definitely NOT third normal form. OK here's where it gets even better

On one web page, I build select controls from this data. The name of the control would be the value of the feature column. So from the data above I would have a select control whose name would be name="hair_color" and another select name="eye_color"

NO problems so far.... ok.
Now after the user selects from the selects (get it, sorry).... i am processing the data.

Although I use javascript for some client side validation... I also want to validate in php. (ok, just because I want to ok)

NOW.. the web page form will post these two variables $hair_color' and '$eye_color' as described above. But I don't know ahead of time what these variables are because they're based on data from a table.......

I go the table described above and select distinct on the feature column - I will return two rows.... see below

while($row = mysql_fetch_row($result_set)) {
$feature =trim($row[0]);
}

the value of feature in the first row is 'hair_color' and in the second row 'eye_color'--


What I'd like to do.... is to take the values in the $feature variable and create a literal variable that I can test for that was posted from the form........

so for example in the first row where $feature = 'hair_color' - I want to create a $hair_color variable...... because this is a variable of the select control from the form. Then for the second row where $feature = 'eye_color' - I want to create an $eye_color variable because again... this is the variable of a select control on the form.

Dynamic Links???
I’ve looked at several tutorials and searched the archives of this site. I found a few pointers, but I feel entirely daft and can’t seem to quite get it.

The “ultimate” goal is to display members profiles, and not have to hard code all the bl**dy records, as I’ve done so far. (Current version http://www.internetbonsaiclub.org/c...y/profiles.html)

So, now I have the records in one table in my database. The profiles.php3 page takes all the records in that table, and displays the names in alphabetical order. So far, so good.

Now, I have viewprofile.php3, which should display only one record at a time, based on which name the visitor clicked on.

Dynamic Communication
I am wondering if there is any way to use maybe XML to mimic another sites form on my site. For example, to use maybe Expedia's flight search form on my site and then post the request to expedia and have the results format back into my site. It is sort of the same concept as xml-rpc accept I am wondering if it can be done without setting up an xml-rpc server for the response. Essentially the script would allow you to take the user through the entire search process all the while making it formatted to the layout of your site, but using Expedia's engine.

Dynamic Notification
Is there a way for me to have an email sent to me anytime one of my users creates/uploads a new file in a specific directory on my website? Sorry if this is really basic.... I'm not sure where to start. Any help would be greatly appreciated.

Dynamic Content In A <div>, Using Php
i have a <DIV> block, and I want the innerHTML to change at the click of a button. for those who don't know some javascript, if you have a dive with an id, <DIV id="myDiv"></DIV> you can change the content inside with a function call

myDiv.innerHTML = "some stuff";

however, i need my data to come from a mySQL database and thus needs to be outputted via php. so ideally i want something like

myDiv.innerHTML = "<?php echo "some stuff"; ?>";

of course that does not work because php is not client side, this is just to illustrate what i want. any ideas on how to do this without iframes?

Dynamic Data
I have included a php script into my page
as <img src="plot.php">. That script just plot some time changing data. Now I have two questions that I cannot solve myself:

(1) When I press the reload button I expected
the plot reflected the changed data.
Instead of that plot remains unchanged
until I directly invoke the php script
from the browser...
Is there any method to avoid this
unwanted caching?

(2) That is a bit off topic but is there
any easy way to get a web page updating
after a certain period of time?
Once solve my first question I'd like
to offer mi visitors a automatically
changing graphic.


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