Print All Selected Items From Dropdown??
I have a program that allows users to select a 'New Graduate' membership, and for each one selected, they get a free tshirt. I've got that working using a 'is_new_grad' function that I created. So, if they select 2, they see 2 dropdowns to select the sizes of them. It then sends an email w/ the membership info and the shirt sizes selected.
However, when the email is being sent, it's only returning the size of the LAST item selected in from the drop-downs. Example: if I sign up for four of these memberships and select four different tshirt sizes (1 Medium, 1 Lg, 1 XL, and 1 XXL), the info in the email is all XXL: Code:
View Complete Forum Thread with Replies
Related Forum Messages:
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 !
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 !
Dropdown Menu <selected Name="...
I have a dropdown menu like this one: <select name="country" tabindex="6" id="select_country"> <option value="">- Country List -</option> <?php $query = "SELECT * FROM country ORDER BY country ASC"; $result = mysql_query($query) or die('Error, query failed'); while ($row = mysql_fetch_array ($result)) { $country = $row['country']; ?> <option value="<?php echo $country ?>"><?php echo $country ?></option> After I have selected one country and I hit the submit button it go back to the default value in the box, what I want is to show the selected value in box until I selected another value. If the default value is Australia when I start this page, I then select USA and hit the submit button it reset to the default value "Australia", but I want it to show USA as long I not select anything else. I have tried to use session in selected="<?php echo $_SESSION['country']; ?>" but it didnt work.
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 !
Setting Variables For Only The Selected Items In Form
when a form has a question where the response can be one or more selections either from a series of chech box inputs or a selection list, how would i set into variables only the responses that are checked or selected so that only these values are available for exporting to a mySQL database?
View Replies !
How To Pass The Value Of Selected Dropdown Menu To Another File?
there is a php-myql script that list the mysql databases in the drop-down menu, use wil select one and the submit button should pass the value or variable $db_name to the test.php, this script list the databases in the drop-down menu but when i select one and then click on submit cannot pass the db_name to the test.php:
View Replies !
Print To Screen The Currently Selected Option
I then need to print to screen the currently selected option, but on the same page- no going to a new page etc. PHP Code: $host = "localhost"; $user = "root"; $password = "!"; $database = "rio_test"; $connection = mysql_connect($host,$user,$password) or die ("Couldn't connect to server."); $db = mysql_select_db($database, $connection) or die ("Couldn't select database."); echo "<select name="ticketName" id="ticketName">"; echo "<option>IPTIS Ticket Name</option>"; $query = "SELECT * FROM new_calculator";
View Replies !
Print 20 Items In 4 Rows Of 5
I have a very simple script that selects the 20 most recent items added to a database and prints each one in an separate table cell down the page. Ideally I would like the output to run across the page as 4 rows with 5 items in each. Can I build something into the print script such that it will start a new row after items 5 10 and 15. Or should I be thinking of running the script 4 times and printing items 1-5, 6-10 etc. Or is there an altogether more elegant way of doing this?
View Replies !
Create A Loop To Print Items From The Database
I want to create a loop to print items from the database. I want to check for product type and assign that to a variable and then list all items with that product type. Then move to the next product type, enter that into the variable and print all items of that product type and so forth.
View Replies !
Show Two Items In A Row When Items Are Picked Randomly?
I've looked at this inside and out to figure out how do a random twice so that it has a much less likely chance to show the same item twice in a row. But rand(1,3) doesn't seems to let you put variables in them $, only numbers. how to make this a lot less likely to show two items in a row when items are picked randomly? I even tried this below, and if two numbers are the same then it shows the higher numbers, but if they are not the same then they show one of the first calls for the random items. Thing is, if they are not the same and it shows the first calls for a random number, its back to the same problem again of showing too many same items again. Anyone know of some easier and more effective ways of doing this? Code:
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 !
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 !
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 !
Print Function To Print Text
Perl has a print function that'll allow you to print text without having to comment out Perl interperated characters. For example: print<<EOF; Text goes here, blah blah blah blah, """,... $$&$&$, EOF Does PHP have a similiar feature?
View Replies !
Print Function Won't Print?
I have been using echo in PHP but I saw most examples use the print function so I tried it, but It wouldn't display anything on the page, I am trying this on a localhost. I used echo instead and it works...so I was just wondering what is it that I haven't setup that the print function isn't working. This was the code i using: session_start(); print($counter); $counter++; session_register("counter");
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 !
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 !
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=Ƈ'> <input type='checkbox' name='t[1]' value=Ƈ'> 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 !
Jump Menu Selected Value
I have a set of 2 menus where the values of the 2nd are dependent on the value selected in the first. Yes, I will (eventually) convert this to a javascript process, but for now I am content reloading the page. I have created a jumpmenu that reloads the page with the state passed in the url (ie. community.php?state=NY). This determines the values displayed in a second (dependent) menu which then lists the counties available for that state. Code:
View Replies !
Collecting Selected Options
how I can achieve the following: Page1 Within form is a list of 100 questions each with their own checkbox, however the user must select to answer only 10 of these questions. So they select the 10 questions they wish to answer. Page2 Then display the 10 questions they selected. I believe this is something straightforward,just i cant get started.
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 !
Get The Data For The Selected Item And Not The First It Comes Across?
I use the GROUP BY command in one of my queries, the trouble is although they share a common field sometimes the data differs in other fields for an individual record. Is it possible with the command to get the data for the selected item and not the first it comes across? For instance if the data is this ID, Cat ID, Name, Data 1, 1, Name 1, bla bl1 2, 1, Name 2, bla bl2 when grouping by cat id and group concat the name, irrespective of the id that is input to the database the query will deliver. Cat ID: 1 Name: Name 1,Name 2 Data: bla bl1 What I want is for the query to output 'bla bl1' when the id on the php page is 1 and 'bla bl2' when the id on the php page is 2. Is this possible? If the way I've explained it is confusing let me know and I'll try to make it clearer.
View Replies !
Multi Select Box Selected
i have two tables: staff ------------ stid, staff 1| lien 2| tony 3| tom 4| henry bill ---------- billid, stid 1| 1,3 i need for it to display all the staff from the staff table in a multiselect box then have the staff in the bill table selected. i can't figure out how to do this. Code:
View Replies !
Sorting Selected Data
I have a script that retrieves data from a database. Now I want to sort these informations by name, date etc... So, the question is how can i sort already selected data? Code:
View Replies !
Display Selected Records
I have a table on a form which contains records that can be multiple selected by checkboxes. A submit button sucessfully sends the record IDs of the checked records to the next page. I want to display the records that were selected via the checkboxes, but the problem is that I get only the first of them.
View Replies !
Database Selected Error
I built a web application for our IT department to handle PC Cases. I used PHP/MySQL for the application. Everything for the most part works fine except every once and a while when you are navigating the pages I get a blank white page with the error "No Database Selected" in the top left hand corner. It seems like the database is timing out or something, or maybe its getting too many queries, I'm just not sure.
View Replies !
Selected Value In Drop Down Menu
I want the first option ("selected" option) in a drop down menu to be based on the URL a user clicks on. For example, if the user clicks on the link: layouts.php?submit=true&category=abstract The first and selected value in the drop down menu should be abstract Then the rest of the menu will pull from the database. The code I am using now (below) lists all my categories from my database, but it is not putting the selected value first. How can I get this to work?? Code:
View Replies !
Outputting Selected Option
Given a dropdown form how can I output the selected option when the submit button is pressed. Box: [red ] [submit] [green ] [blue ] [orange] so the user selects an option from the dropdown menu, which is highlited then they press submit, I want to display red, green, blue or orange, whatever was submitted.
View Replies !
Display Emails Once Selected
I have an admin area where i can send emails to any selected member using using checkboxes. On submission it sends you to the next page where the email is then sent. All the emails that have been selected are then displayed Code:
View Replies !
Showing Selected Parent
In my CMS, I have parent and children categories in one level and in one table (id, name, subcat). What i would like to do is, in PHP of course: Upon editing a category, in a dropdown box, show selected, the parent of the category. if there is no parent, show selected, a message saying "Not a subcategory". In the selection though, still shows the parent options as possible selections. } Can anyone help show me the right direction I need to go with this? Do I need a join in my sql or do I need multiple sql queries? Moreso, how do I accomplish this after the query is completed? I am not sure how to go about this.. Code:
View Replies !
|