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




Autopopulating Drop Down Not Saving Unless A Selection Is Made


I have a form that autopopulates and allows user to make changes where necessary. In this form are some drop down menus (hardcoded on the page). All the selections (50 states for example) are there. If I select a state it will then post to the database. If I don't select a state and just leave it as the previously selected state (not change the selection already made by a user) it puts a blank in the database.

Examples:
The <?="$rest_state_pr"?> will pull the state the user selected previously. If I change the slelection it saves the new selection, but if I leave it as the "default" It puts a blank in the database. Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Saving Selection In Drop-down Lists In PHP After Page Reload?
I can't find an answer to my quesiton anywhere.

Given a drop-down list with USA states and other text fields I pass
this information for further processing via PHP. If any of the required

fields is empty, the PHP script would return an error and reload the
form page asking to fill out those fields. All entered information is
saved... except for the drop-down list selection. I tried to write a
Javascript function which is echoed by PHP, but interpolation of PHP
variables in the Javascript section gives a syntax error message in
Javascript.

The PHP script returns, e.g., an "AL" string for Alabama. Of course, I
don't want to write PHP code for each option to make it selected.

Remember Drop Down Box Selection
Is there a better way to do it than i currently am using? Simply echos the value in the selected option that will otherwise be blank, so this makes it impossible for the user to select no input. Code:

Drop Down Menu Selection Activation
I have a form that is populated with a drop down list and a list box. I
want to be able to automatically populate the list box, whenever a user
selects a new item from the drop down list.

Is there a way of doing this as soon as a new item is selected from the
drop down box? (I'm trying to mimic a rich client interface in a web
browser).

User Selection From Drop Down Menu
I have 2 drop down menus. 1 is to pick a Province and the other is to
pick a trade (plumbng electrical etc)

The user selects which province and then what trade then hits submit
which should list all entries in the table. How would I formulate the
select statment for MySQL to display the results in a webpage. The
variable in my form are $province and $category

Drop Down Boxes Change By Selection
what i'm trying to do is when a user selects a country say UK, all the uk states are displayed in another selection box below BUT if the US is selected all the us states are shown, this is on nion every friends/dating site just curious as to how this is done.

Chain Selection For Drop Down Menu
I have a java script that has a drop down menu where a person select a state and then all the cities for that state show up right next to it.

my problem is that the script it is making the webpage runing slow, or sometimes is telling me that the insternet explorer is running slow because of it and i was wondering if there is a better way to do this with PHP and where should i start

Filtering Selection In Multiple Drop Down Boxes
I want to allow a user to conduct a search on a database using multiple drop down boxes.
On the first page they will have a drop box filled with records from field A. Once they select which one they want, a second drop down box will then appear with records from field B which are present for field A (a filter).

What I want though is that the first dwon down box still appears on the second page, but shows the record that the user selected. What is happening now is that when the second page comes up, the first box shows the default selection rather than the selection that the user chose. My code for the drop down boxes is: PHP Code:

Populate A Drop Down List In A Form On The Basis Of A First Selection
I have developed a form to register a property in a db. The form needs the selection of a country and then based on that selection the selection of regions from the selected country. I have a program which allows selection of a country and then a region but it uses java script which I would like to avoid. I also just wanted one submit button if possible. Code:

Saving/Loading Data In Drop-down List
I have a drop-down list with set values.  When there is a corresponding value in my database when the page loads I want the drop-down list to pick the appropriate value from the list.  Instead it always defaults to the first value.  Can anyone give me an example of how to do this?

Also, one time after adding a variable to a classes file this symbol:  started showing up on all of my pages. Has anyone seen this before? I can't find any information on the web about it.

I Had Problem With Cms Made Simple Can Anybody Help Me?
May i know how to include cmsms to my site?
For example
site:www.example.com
content:e-commerce site.
problems
1.how to connect my site to the cmsms?
2. how to connect to mysql tables ,and how it automatically fetch the
data from the userdetails and category details and all these ?
3.is there any site domain which will help me to understand better?
4.how is the user interactivity with the mysql database.
5.where to remove the install directory?
because i tried to remake a site wich having the dbname shop so i
finished the instalation but i got thid warning
Warning: install directory still exists.

Sessions Made Personal
I am just building a site for someone and i was wondering how can we make a session personal so when someone looks in their previous sessions in their browse they will be able to see Arabian Airlines rather than PHPSESSION? Below is the code i currently use to create the session. Code:

Process Array Made With Chcekboxes
I don't know why I can't get this to work

I have a form with a number of checkboxes on one page
<input type=checkbox name="listing" value=$ID>

I then want to process only the listings that were checked, so: (I tried to use a while and a foreach, neither worked)

A Good Pre-made Subscription System.
I need to track down a free and simple system to allow our users to purchase a content subscription to our site, but need a simple way for them to do so in real time with their credit card.

Any recommendations? I just think there has to be a good PHP/MySQL package out there I can use.

PHP-MySQL: Returning ID When New Record Is Made?
Let's say I create a new record in a table like this:
mysql_query("INSERT INTO table (col1) VALUES ('example')",$conn);

....that had an auto-incrementing, unique identifying column named "ID"
that would be populated with a unique number upon insertion...

How can I get the unique number it assigned to that record returned for
futher use?

Ready-Made Website Tools?
In the same way that you no longer need to write your own shopping
carts, Id like to not write other common PHP features of websites.

Specifically I am looking for an open source user management package
(registration, login, account management) with a nice clean interface
that I can just drop into my website. I figure this would be
preferable to writing it myself as it will be better tested and more
secure.

In general I am looking for pointers to collections of PHP tools that
we can just drop in to our websites to perform common functions.

System(); Not Working Within A Made Function
for some reason system(); isnt working when i use it within a function i made, is there a reason? it works perfectly fine out of the function.

Creating An If Statment Made Out Of Variables.
What I am trying to do is create an if statement that is made out of purely variables, but I am having trouble getting it to work properly. Code:

Deleting A Cookie That Was Made Before A Certain Date
I have changed the login code for a forum but imagine a lot of the users has a cookie already set. Is there some way I can see when I cookie was made and delete it if it is older than a specific date?

Ready-made Function For Ordinal Output: 1st 2nd 3rd 4th...?
Is there a ready-made function for outputing a variable in the form
1st
2nd
3rd
4th
etc.
by detecting if the integer is a 1, 2, 3 etc Not that it would be terribly hard to write, but if it already exists...

Any Ready Made CMS Package That Can Integrate Into Mainpage?
any ready made CMS package that can integrate into mainpage? eg. user can edit the mainpage content with several category themself without need the programmer edit the source code.

Drop Down Lists Changing Depending On Other Drop Downs
I want to have a drop down system like this one.  But without the radio buttons.

I want to have 3 drop downs but have no idea how to go about it.  I assume I will need to activate some sort of Javascript on the onChange event of the option drop downs.

Sort Search Results - Query Made From Form Variables
I have created a search engine with multiple search fields, the results.php page shows the results.
My question is, how can I allow the user to sort the results (name, description, price etc), simply by clicking on the column title. This wouldn't be a problem if the SELECT query was constant - just add a $var at the end where ORDER BY should be, but how can I do this when the SELECT statement is made up of $_POST VARS? Surely if I reload the page with the sort command, it will have forgotten the $_POST vars that made up the query?
I have searched EVERYWHERE for help on this PHP Code:

Selection
I am making a log generator and I have a minor issue with this script PHP Code:

Selection Box Via Selection
Basically I have a selection box which gets it's values from a database once this is selected the selection box's below will get the correct value from the above selection box which again comes from the database.

The first selection box works by refreshing the current page and adding a variable to the file for example instead of useraddnew.php it would be useraddnew.php?maintcat=5 but the number 5 only gets set the second time you choose from the top selection I hope some one can help sorry if I explained it poorly. Code:

Date Selection
I have some records in my table that I need to extract if they are equal or greated than the current date. The date fields are in format YYYY-MM-DD. Could someone please provide some details on how to do this in php, I think I have a rough idea.

Set date variable to current date, select all records from database where database date is >= current date.

Selection Of Ajax Lib ?
I m working on an PHP based site where in UI I need to use ajax
funtionalities ... I just want some opinion from experts that which LIB
is best for usage.

I was wondering that using XMLHTTP is sometimes a bottleneck for cross
browsers application.

Different libraries are here but not sure which one to select.

Selection Box Only Showing 1 Why?
I am using the following select code: PHP Code:

Database Selection
I created two web database applications - first one is the company
news system (as part of the company pages), second one is the
company data presentation system (part of the company pages, too).
All (unfortunately) the M$ environment - NT or 2003 server.

The first app is managed from the web interface, the second app is
managed by database client win32 app (created by PowerBuilder, std
client-server approach, ODBC). For the second app I need to create
the web presentation interface now (no data modifications, heavy sql
queries :-( ).

The first app contains only small amount of data (10 database
tables, max 100 rows in the largest table) but the second app
contains large number of tables, more than 100000 rows in major part
of tables, very sensitive company data, requires sophisticated and
intelligent db engine strategies for queries, ...

For the first app I wanted to use MySQL, for the second one I wanted
the Sybase SQL Anywhere. But now I am in doubt. I'm playing with the
idea to substitute the Sybase SQL Anywhere by the PostgreSQL or
MySQL. I need all the SQL decorations (stored procedures, stored
functions, triggers, declarative referential integrity (foreign
keys), ...) I'm playing with the idea to unify the database
environment (use only one db engine and two databases, not two
different db engines for two databases), too.

Is the MySQL or (preferably-IMHO) PostgreSQL database engine stable,
robust, safe, ..... in order to use it for these company very
sensitive data, for heavy data mining app, ... ? Is it safe to unify
the database engine types and use only one engine for these two
apps/dbs? Can I rely on the MySQL and/or PostgreSQL engines? Do you
suggest me to use (one of/both) these two db engines for the main
company data presentation database?

Multiple Selection
I have a form that grabs reords from a mySQL database and presents the information in a nice pulldown menu. The client now wants that little menu to be a list that you can select multiple resords from (this is a brochure request for - the list has a max of 12 pieces).

I know how to get the form to look the way I want, but when I parse the form with the little app I wrote in PHP that varifies the data entered, checks feilds, and then enters it in a mySQL database for tracking purposes - there is only one record in the database - even though there were more that one records selected. Now I am simply entering $properties (the variable of the menu feild) in the the INSERT statement of my database query - do I need to parse the records selected first - what am I doing wrong...?

Seperate Selection
I am trying to select data stored in a database as u can see and it gets dispalyed. But my problem is I need to beable to select each item individually instead of all at once or 1 item only. I need to beable to select say bread as an item and milk as an item but at the moment I can only select 1 or all items. PHP Code:

Selection From A List Box.
php and have to implement this functionality to
select a user from a list box. I have written the code for this, but
the problem is after selecting a name and doing the required task, it
again selects the first entry in the list box. So if there are 100
users, the 100th one has to scroll down again and again.

I need to modify this code so that until the session expires, if a
person has selected his name once, that name will be selected in the
listbox until he changes it.

<select name="name" style="width: 120px;">
<?php
$query = sprintf("select * from person order by person_name");
$result = mysql_query($query);
$i = 0;
while($row = mysql_fetch_array($result))
{
$i++;
printf("<option
value="$row[person_num]">$row[person_name]</option>");
}
?>
</select>

Form Selection
I am working on a form right now that when you click a radio button at the top it will select a few of the other radio buttons. Here is the code that i have. I just dont know how to do this. I have never done this type of form before. Code:

Listbox And Its Selection
im trying to create a webpage using mysql and php. im using the below code to populate a listbox with playernames held in my database. once i select a name; im trying to make the page gather the relevant information from that users details to be displayed on the same page.

for example if i select "MoFish" from the listbox, i want it to echo all MoFish's details in the page such as his:

"age"
"height"
"weight"

if i select "Berty" i want it to echo bertys details. how can i acheive this? Code:

Random Selection
i want to randomly select 5 different values from a database, from one table, and then just assign those values to some php variable.

Option Selection
I am making a Option Box (Drop down bar) for Gender, (Male,Female) and I want when they Select there Gener, and then hit submit, it Writes to to a Database.

i have it set it up so far that it goes to another page to INSERT it into the Databse.

Dynamic Variable Selection...
Is it possible to create a bunch of variables in a loop with different #'s at the end of their name... like:

while ($counter <= 10)
{
$myvar$counter;
}

to create 10 variables.... mayvar1, mayvar2, mayvar3, etc.....
is there a way to do that?

Getting Multiple Selection Into One String
I have a listbox with 5 options. I have set it up to be able to choise more than one option. What I need to know is how to get all the selection into the one string that is stored in the DB

It is easy to get the first selected option to post into the DB.

Random Selection Of CSV's
Is there a function in PHP-MySQL to randomly select comma-seperated
variables in a text field?

For example if you have a text field containing the values
"1,1.2,4,5.6," is there a way of randomly selecting one of the numbers?

Multiple Selection Form
I have made a multiple selection form, but when I select more than one option, it still only returns one. PHP Code:

Random Selection Of String Value
Please tell me how I can randomly select a string from a limited set
of string, and then use it in links.

With equal probability, suppose half the time I want
to form a link to domain.com/1234/page.htm and half the time I
want to link to domain.com/5678/page.htm . I would like to be
able to put something into my link such as:
domain.com/<?php ... WHAT GOES HERE? ... ?>/page.htm

If possible, I'd like to use a method that will put either 1234 or
5678 into a variable, so that, once it's randomly chosen for a
document sent to the browser, then numerous references to that
same string value can be used on the page.

Multiple Selection Lists?
i have a mutliple selection list on a form that goes like this

<select name='name' multiple size=6>";
echo "<option value='one'>one";
echo "<option value='two'>two";
echo "<option value='three'>three"; etc it works fine.

BUT how do u call it. For example say i selected option one and three. How do i call that on the next page so that ONE and THREE are stored.

Printing A Document Or Selection
Is it possible to print output generated with php to a local printer attached to a PC or MAC... The server being used is shared hosting.. not a windows server... I was looking at the Printer Function in the php manual but it is not very clear.

Selection Of Records In List
I was wondering how to query MySQL to display only a selection (1-20,
21-40) of a query in an HTML list. Can that be done in an SQL
statement, or do you have to use PHP to dissect the returned array
with for n elements to n+20 elements. How does Google achieve the
returning of results in its search engine. I imagine that the same
query may not necessarily be executed each page listing. I am
wondering whether the results from the query would return an array of
say 36000 elements.

Make Selection In Array
I have this array:

name => john, age => 45, profession => teacher
name => hank, age => 22, profession => student
name => mary, age => 36, profession => dancer
etc.
etc.

It's going to be a big array.

Now what i wonder, how can i do the following;
while( $array['name'] == 22 )
{

do something.

}

I want to prevent the following:
while( $array )
{

if( 'name' == 22 ){

do something

}

}

Because this would create a big loop everytime.

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:

Multiple Lists Selection
I am using a simple registration form that i made with the toolbox, but when I come to a multiple list to choose from (populated from the database) it doesn't work correctly. Of course, out of the multiple items selected only the last one gets inserted.

From what I have read, the selection must be turned into an array then looped for this to work. Is this correct? Next how would I code this to work right. If you let me know which code to post, I will post it.

How To Combining 2 Db Fields Into One Selection?
In my db I have 2 fields: first_name and last_name & I want to combine these 2 fields in my drop-down menu.

What I have now is showing only the first_name -- I know that it needs to go into the third option in here, I'm just not sure how to get both of them into it. I can get the first_name OR last_name, but not combined. Code:

Multiple Selection Lists &
I have 2 multiple selection lists. I am using javascript so that users can select items from list 1 and move them to list 2. When the user submits the form I need my php to get the values he has/she has in list 2...

I have done printf($_POST['list_2']) and it only shows one value, even when multiple are selected. I read that I need to change it's name to list_2[] but if I add the brackets to the name my javascript quits working.

Form Selection Target
I would like to design 1 php page where a dropdown list will appear. depending on the user's selection, it will go to the next dropdown list (the list will appear only after the first dropdown is selected) and so on.. .. at the end, a textarea box will appear that will display all the variables that the user have selected. How do I go about in making that happen?


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