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 Selects From $_POST


I'm still working on my form, and part of the form is an age select dropdown. I'm leading them through an approval process and if they'd like, returning them to the form to fix any errors.

The only way I know of having it show up correct in the dropdowns is to do an if statement on each option from the $_POST data. This is cumbersome, as I have 3 selection boxes with many options in each. Is there a better way to do this than to create an if statement for each option?




View Complete Forum Thread with Replies

Related Forum Messages:
Dropdown List Which Selects A Post A Title (to Edit)
I want to have a dropdown list which selects a post a title (to edit), then when you click submit I want to use POST to submit the data for that post (post title, username, subject, content) so that the edit pages form fields will already be filled with the posts data.

View Replies !
Dropdown Date Selector That Automatically Selects Todays Date
Does anyone have a PHP generated dropdown date selector that automatically selects todays date on page load that i can pinch?

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 !
Selects
How come my second select form is blank for the first option? I realize the problem is when I put in the $series_design tag, but I don't know why.

View Replies !
Multiple Selects
I want to do a multiple select like this where the user can select multiple items

<SELECT NAME="abc" MULTIPLE>
<OPTION VALUE="A">A
<OPTION VALUE="B">B
<OPTION VALUE="C">C
<OPTION VALUE="D">D
</SELECT>

How do I reference these variable in code or the form that does the processing?

View Replies !
MySQL Selects
I just made my first sql database and PHP interface for it last week I'm getting pretty far with it however I'm having a problem with the select statement. It's looking like this:

SELECT * FROM freehosted WHERE website='$website' AND type='FHG' AND category='$category' OR keywords LIKE '%$category%'

This is working good, however I ONLY want the website designated in the $website variable to display. Code:

View Replies !
Bypassing Selects
I have a profile system which allows members to input info and save it to the database for there profile. A few fields are SELECTS. From Sexuality Favourite Music, So for instance From (England, Scotland, Wales, Ireland) THat works fine, but what happens if someone makes a html document and injects code"

<OPTION>HACK HAHA</OPTION>

Then posts it to my php that excutes and writes to the database. In essance they can bypass the select I have and input what ever data they want. Whats the best way around that, I was going to use a SET in the database structure but one of the selects has about 90 options.

View Replies !
MySQL Selects
what's the most efficient way to grab a single data value from a table field using PHP. the best I have is using a while loop -- but something tells me there is a cleaner/more efficient way:

$sql="select countryType from c_countries where userid={$_SESSION[userid]}";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){ $userCountryType = $row[countryType]; }

View Replies !
MySQL Question (sub-selects)
I've seen a few posts about getting around the sub-select problems with MySQL. I am trying to do a "NOT IN" type select, as follows:

SELECT
email
FROM
orfcustomers
WHERE
customerid NOT IN
( SELECT
c.customerid
FROM
orfcustomers c,
orforders o
WHERE
o.customerid = c.customerid
);

Basically, I have a customer table, and an order table, and I want all customers' email addresses that have not yet placed orders.

I can't find a reasonable method for doing this, because I haven't had much experience with the INNER JOINS and LEFT JOINS, etc. Also, the tables each have over 40,000 entries, making it a little weird.

View Replies !
Dynamic Form Selects
How do you make dynamic for selects in php? It is in regards to a modify type scripts im writing in php/mysql.

So regular select drop downs look like so:

<select name=genericselect>
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

right, well if I was pulling info from a database, how would I make is so that the 'selected' value is dynamic and comes from the database? Im sure theres a simple way of doing this.

View Replies !
Selects All Of The Check Boxes
how would i make it to where someone can press all and it selects all of the check boxes in the area.

View Replies !
If Statement Thats Selects Whether $s Is Chosen
I have an if statement thats selects whether $s is chosen or $t is chosen or $u is chosen, if $s is chosen i want the values of $t and $u to be '&nbsp' so if $t is chosen i want the value of $s to be '&nbsp' and $u to be '&nbsp' and yes you've got it now if $u is chosen i want the value of $s and $t to be '&nbsp' Any ideas my codes below:

if ($val=='Currently In Place') $s='X'
else if ($val=='Required Essential') $t='X'
else if ($val=='Required-Recommended') $u='X'

View Replies !
GET, POST, Multi-Selects
When the HTML of a form has a field name 'choices' and has five checkboxes with that name, each with a different value, like this:

Code:
<form name="testform" action="processor.php" method="post">
<input type="checkbox" name="choices" value="One">One
<input type="checkbox" name="choices" value="Two">Two
<input type="checkbox" name="choices" value="Three">Three
<input type="checkbox" name="choices" value="Four">Four
<input type="checkbox" name="choices" value="Five">Five
<input type="submit" value="submit" name="submit">
</form>

In PHP, without altering the HTML at all (assume that I have no control over the HTML because there will be remote forms already coded by others that submit to this script) if I look at the values through the PHP-approved method (assuming that every checkbox was checked by the user), I see: Code:

View Replies !
Handle Selects W Multiple Values
does php 5 have a problem with html select lists which allow to choose multiple items?
Whatever I tried I just can't get another or more than the last item selected in the list. Even if I select multiple items, a print_r($_POST) just shows the last selected item, and not a array of all selected values.

View Replies !
Number Format - Selects Prices From A Database
I have a loop that selects prices from a database, prints each price out individually and then adds it to a variable, the "final price".

$thisprice = $row[ITEM_PRICE] * $row[SEL_ITEM_QTY];
$thisprice = number_format($thisprice, 2);
echo("$thisprice")
$finalprice = $finalprice + $thisprice;

But for some reason, when the $finalprice variable is set to more than $999, it won't display the correct price. Does anyone have any idea why this is? Does it have to do with the comma in the price? How can I fix this?

View Replies !
Master FORM Which Selects Between Slave FORMS...
I wish to have a simple multi-dropdown donate option, the user selects a pre-defined amount from dropdown1 then they choose the payment gateway (paypal, stormpay, e-gold, intgold etc) from dropdown2, then click Go!

However, each of these gateways code is embeded on the page as a form (as buttons, no input required).

Is there a way to use a "master" form in php, which selects between multiple other "slave" forms via a dropdown select and submits that value?

I also need a dynamic "payment amount" as dropdown menu (or text input) menu which inserts its value (amount to donate) anywhere on the page as a dynamic php include... (including form value fields) so when the master form is submitted, the "payment amount" include will refresh the value within any of the sub forms vaules upon submitting the MASTER form.

View Replies !
Nested Selects - Works In Mysql, Fails In PHP
Not sure why its failing. But if I run this statement through phpMyAdmin it works fine, but when I drop it into my php file it generates the following error. Code:

View Replies !
User Selects Browser Back Button
I using a alert JavaScript message to display once an user submits a form, the message displays fine, but say the user goes to another screen and hits the browser back button, the same message displays again, is there a way to clear the message once displayed the first time.

View Replies !
Updating Database - Selects All The Data From The Master Table
We have pages that allow the user to enter information. The data is stored in or comes from an oracle table that is not denormalized. This information is gathered on 3 pages and on the 4th page we show a summary and then update the database. My job is to add a new page before the summary page. However, the data I am gathering is in a normalized table that is linked to the other table with a foreign key.

The developer who wrote this selects all the data from the master table on page 1. The columns are all prefaced with 'AP_' and he uses the following code:

View Replies !
How To Display Html Form Selects (via Checkbox) In Email?
I have a simple form to collect user selections in html form. I am
pretty new to php...how can I send the user's checkbox selects to me
in an email...I am struggling with buiding an array to send this info...

View Replies !
Selects The Item And Check Out/in Date And Time To Add A Reservation
It is a simple equipment check out calendar; the user selects the item and check out/in date and time to add a reservation. When I add a reservation on an item, I'm getting this error message: Code:

View Replies !
Mysql SELECT Query That Selects The Latest Items
I am building a website that has a software download category, and has news on the main page. Now I have two tables, named "news" and "software". On the main page I want to select the latest 40 updated items, so whether it is a newspost from table "news" or an extra entry in table "software", or an updated version of an entry in "software".

They are all INT types holding a time() string. what I want is a mysql SELECT query that selects the 40 latest items.

View Replies !
How To Populate Selects With Years=>months=>days That Dynamically Change?
What I'm thinking of doing is in my admin page have three different selects. They will form the day of sales at my shop.

-YEAR- -MONTH- -DAY-

The years will have 2002 -> 2005 and the months will be the 12 months of the year of course but I need the number of days to change with the particular month selected.

View Replies !
Construct A Dynamic Navigation That Expands When A Visitor Selects A Sub-directory.
I am trying to construct a dynamic navigation that expands when a visitor selects a sub-directory. The site has 6 sub-directories, plus the root. Is there a way to use a wildcard or something, to indicate all contents of a directory?

For example (this does not work):

<?if($_SERVER['PHP_SELF']=="/cars/*"){?>

Anyone know of a solution? What about the root level, is there an option for that too?

View Replies !
$_POST Variable Set Although Did Not Use Var=$_POST['var']
I have a script with a form with method= POST in which there is:

a. A button that takes me to the 'view-rb.php' script:
form.= " <input type="submit" name="viewRbLine" value="View" onclick="f1.action='view-rb.php' return true;" > ";

b. a form variable: 'refreshNum'

Code:

View Replies !
Parse Error With "if (isset($_POST['min']) && Isset($_POST['max'])"
I'm making a form where one of the results is created by a range of dates. I have 2 drop down boxes that are populated with "date" data from the table and they pass it onto the results page using the "Post" method. My host is Godaddy / Linux and my table is MySQL ver 4.1 Code:

View Replies !
Fill Fields When User Selects User From DB
I have a field with a selectbox which contains a list of client names and several other fields which display information from the DB.

I need to be able to make the fields change to the appropriate information when a user is selected from the select box. Can anybody please give me an example of a bit of code that will do this?

View Replies !
Looking For Dropdown Help
I have a dropdown in which i want it to open a soundfile when selected. So, how do I go about this. The form will get submitted, and through a series of conditional statements it will point the right selection to the right if statement. but what do I put in the if statement to get it to open a realplayer with my ram file?? Here's what I got so far.
Code: <FORM ACTION="<?=$_SERVER['PHP_SELF']?mode=changedropdown?>" METHOD="POST" NAME="sermondropdown">
<P>
<SELECT NAME="sermons" SIZE="1" onchange="this.form.submit();">
<OPTION VALUE="pleaseselectasermon">Please Select a Sermon
<OPTION VALUE="082403Daniel_1_1-8">August 24, 2003 Daniel 1:1-8
<OPTION VALUE="083103Daniel_1_1-8">August 31, 2003 Daniel 1:1-8
</SELECT></P>
</FORM>

<?
if('changedropdown' == $_GET['mode']) {
$selection = $_POST['sermons'];
if (?Daniel_1_1-8' == $selection) {

} elseif (?Daniel_1_1-8' == $selection) {

}
?>

View Replies !
Dropdown
I have a dynamic drop down that needs to be populated from different columns in a database. The problem I'm running into is that sometimes fields do not have a value. So I would rather those didn't print out. The code below prints out the blank fields.

I know I need to loop through and check for an empty value, but I'm drawing a blank on the how part. Code:

View Replies !
Dropdown Possible With PHP ?
i'm looking for a way to do the following :

1. selecting data from a MySQL database
2. putting one field into a dropdown
3. after selecting a value from the dropdown follow some more php code

step 1 is no problem, step 2 is no problem with the html select statement however this leaves me on the client side. After this i'm not able to return to the server side to execute some more php code, with the onchange attribute i can start some javascript but i want ( read need ) to use php code. Concrete question : is there a way to create a dropdown in pure php code ?

View Replies !
Value In A Dropdown
I have a piece of code where I get the player_id value from the url at the top of the page. Rather than this I want to get the value from variable named $player_one. Code:

View Replies !
Dropdown Box
I want to create a form with a default image and a below it, dropdown box and a series of options in it. When the user clicks on the submit button after selecting their option, the default image above the box is replaced and a title or caption next to the new image would appear.

For example the user might select 'option C' from the drop-down list. They then click submit. The default image would be replaced with the selected option or the page would reload with the new image and a title or caption next to the image.

View Replies !
Dropdown Box Is Too Big
I want to know the code to restrict the dropdown box to a certain number of characters as the data from the db is too big. I want it to display say 50 characters.

View Replies !
Dropdown Box And A Query
Heres my situation:

In a form I want to read the categories listed in table $inv_table and present them in a dropdown window so the viewer can choose and add to a different table. The script below works with one glitch. There is a huge white space on the page above the dropdown box. This will get me by but it isn't too purty.

<td valign="bottom">
<a name="theform">
<select name="catname" size="1">
<?
{
$result = mysql_query("SELECT DISTINCT category FROM $inv_table ORDER by category",$db);
while ($myrow = mysql_fetch_array($result))
{
echo "<option>".$myrow["category"]."</option><br>";
}
}
?>
</SELECT>
</td>

View Replies !
Dropdown List
I have a Dropdown list with Select with 1, 2, 3, 4, after select on of them it bust to refresh the page to what you select but it don't do it. PHP Code:

View Replies !
Dynamic Dropdown?
I am posting a code for dynamic dropdown by Leon Atkinson, it works fine but i have a doubt: I tried to add another functionality to it where i got stuck! Once the city also gets selected from the second drop down i wanted that on clicking the submit button it should go to some html page wrt to the city choice. Code:

View Replies !
Dynamic Dropdown Box
im looking to have two drop down boxs one with makes of car and
the second drop down box to automatically populate with all the model
of that particular make of car. there are about 50 makes and upto 50
models per make.

I just would like to know the best way to do this - javascript or use
a database? it would be a lot of code todo it in javascript wouldnt
it?

View Replies !
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 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 !
MySQL Dropdown
Is there a way to make a dropdown by getting the options directly from the database? And I'm using this as a form so it has to have a name so I can call upon the value and do something to it.

Example to what I want to do:

- I have a database table named members and in that table, it has 3 columns - name, age, sex.

What I want to do is make a dropdown inside a <form> using the data from the database. And then when the person selects the name of the member and presses submit, it deletes the row with that name from the table and the database.

View Replies !
Change Dropdown Value
i've two dropdown fields

1) products - (mobile phone, camera, webcam, tv, dvd player and etc
2) accessories

how accessories field can be changed if visitor selects product.

for example: if visitor selects TV, accessories field should automatically changed with cable wire, electric board and etc (without reloading)

another example is www bestessays com/order.php
when you'll select "Thesis" from type of document, urgency and cost per page values will be changed.

View Replies !
Months Dropdown
I'm looking to do a dropdown with the months in the year starting with this month and going on for 12 months, ie. the selected month is April 2007 and the last month is March 2008, does anyone know how to do this using PHP?

View Replies !
Last 3 Months Dropdown
I need to come up with something that will take the current month, for example this month is april.
It would create a drop down list like

Feb 1 - feb 30
march 1 - march 30
April 1 - April 30
Basically the last 3 months, including this one.
Then I am going to need to save the month as the value, so I can pass it to the script so I know what date ranges I am looking for.
I can't think of a logical way to do this, and still account for the fact that some months have 29 days, some have 30, and some have 31.

View Replies !
Dropdown Menu
i seem to be having some problems on finding how this ajax drop down menu i seen at Anime-Eden.com.

it has a nice effect on how it appears. Now i am familar on how PLAIN drop down menu works, but not how this works.

View Replies !
Dropdown List Box
I am able to populate data in a dropdown list box using php and mysql. However, I a wondering if i can add inside some icons such as close or More records,  where the drop down acts to the specified request, ie., closing the drop down or fetching  some more data from backend.

View Replies !
Dropdown Population
I use the code below to populate a dropdown box from mysql, problem is it goes to the end of the table when it does its stuff. Each colmb in the table has different amounts of records. So if a colmb has less data than the colmb with the largest amount of data it fills the end of the dropdown box with whitespace.

<select name="Location1">

<?php

$query=mysql_query("SELECT $BusState FROM $locationtype");
while ($fetch=mysql_fetch_assoc($query)) {
echo '<option value="'.$fetch[$BusState].'">'.$fetch[$BusState].'</option>'
}
?></select>

View Replies !
Dropdown Lists
I've been doing a site for a while now that has several drop down lists in a form. On one form there is the same drop down list repeated 3 times from the same table in a database but with different values. What would be the best way to repeat the code without repeating all of the code. Basically looking at an more economical way to do things. Would you do a while statement and loop through them or maybe a single array and call it when you need it. Any opions?

View Replies !
Refreshing Dropdown Box
I did some searching here, and it looks like refreshing is what I need,but it seems that most posts were 2005 or older. Maybe there is a new way to do this?

I have a form that inckudes two dropdown boxes. One is Category and the other is Subcategory. To make things simple, let's say I have Fruits selected in Category.

Subcategory would have a list of fruits, like Apples, Bananas, Oranges. If one changes Category to Vegtables, I want subcategory to automatically refresh with a new list,like Beans, Carrots, Peas. What is the best way to do that?

View Replies !
Populate Dropdown
I've written a form for uploading data to a mysql database. To limit user error, I'd like one of the fields to be a dropdown of the contents of an image folder. I've got a dropdown of some mysql data taken from the database.

that's fine. And I can display the contents of the image folder in a big static block. that's fine too. But I can't seem to combine the techniques. point me in the right direction.

View Replies !
Dependent Dropdown
I have set up a MySQL database with 5 tables that are relevent to this question. The first table is for entering records, the second has only 2 foreign keys that join the first and the third together,

the third has a primary key for numerical value and a name column, that is used for the first dynamic dropdown list, the forth table, like the second has only 2 foreign keys to join the third table and the fith table and finally the fith table, like the third table has a primary key for a numerical value and a name column for the planned dropdown menu.

How I can get the first dropdown menu to work, how do I get the second one to run off it and the form or forms need to submit to 3 tables, how do I do that?

View Replies !
Use A Dropdown Menu
I have a list of contacts which are sorted by name. I was hoping to create a dropdown menu in which someone can sort the list of contacts by office, city, state, and contact type. Is this possible? (I am sure it is, but I am not sure what the concept is called so I may research how to do it).

View Replies !
Dropdown Menus
i would like a Dropdown menu ordered by the parent cat and then showing its sub cats like below:

<SELECT>
<option value=0>Cat Name</option>
<option value=?>-Sub Cat</option>
<option value=?>-Sub Cat</option>
<option value=?>-Sub Cat</option>
<option value=0>Cat Name</option>
<option value=?>-Sub Cat</option>
<option value=?>-Sub Cat</option>
<option value=?>-Sub Cat</option>
</SELECT>

View Replies !

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