Cascade Dropdown Or Conditional List
I would like to create a conditional cascade form. based on the selection, it can display or not display an input form for the user to enter an string of text. then at the bottom of the page (or when a user submit) connect all the sections including the input field all together (it's like a story maker?)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Conditional List Boxes
I am attempting to create a list box that is dynamically populated based on the selection of another list box. I am in way over my head..only way to learn I guess. The code below has a year listbox and then based on the year selection, the page should either show another listbox (show industry selection when year <> 2005) or it should render the main form (when year=2005). I cannot get the main form to appear. Code:
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:
Dropdown List
i am trying to get two dropdown lists working on a page. How do i go about this. For example, I have 1 table which holds countries and cities. When a user selects a country in the first dropdown list, i'd like the second dropdownlist populate with a list of cities etc. from my database.
Populating Dropdown List
I am wanting to know how to populate the <SELECT> dropdown menu with all existing values from the DB and also have the value associated with that id selected. This is an updating area of my admin. Any ideas? Here's the code so far. At the moment it only retrieves the value assigned to that id. PHP Code:
Smarter Way Of Doing Dropdown List?
I've got a dropdown list that is acting as a filter on a table, so the user can select a value and the page is reloaded only showing the matching values from the database. Now when the page reloads the dropdown was set to 'all' as it was first in the list, even if I'd selected a different value, this was confusing for users, so I added an initial <option> field which pulled the correct value from $_GET (code below) - however this is a little odd as it means the value appears twice! Does anyone have a genius solution to this? I've seen a <select selected="yes"> sort of thing around, but I don't know how I can tell the php to add this value dynamically? <select size='1' name='occupation'> <option>".$_GET['occupation']."</option> <option value='All'>All</option> <option value='Student'>Students</a></option> <option value='Professional'>Professional</option> <option value='Hobbyist'>Hobbyists</option> </select>
Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...? what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table? 1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code. 2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know? i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.
Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server. I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).
Dropdown List - Trying To Get Default Populated From Db.
Nooby question but when I try and get this to work (it should identify which rows in the database have GK, MID, DEF, FWD against them and then put SELECTED into the option value to give a default of what the entry is currently) it just adds SELECTED to all the results as if $row["Position"] is returning true against all four conditions? What am I doing wrong? CODE:..
Microsoft Access Dropdown List
l am building a new site using PHP which has a lot of pages pulling from an Access Database. I would like to have a dropdown list that pulls exhibitions from the database and then when the user selects one it shows the rest of the details from DB just below the dropdown list, hope that makes sense. Code:
Change List View To Dropdown Menu
Im working on a script that has to be change so a user can choose from a dropdown menu instead of a list that now is displayed. Here is the part that is insert on the index page.
Easy Comma-delimited List To Dropdown Box Converter
I was working on a simple converter when I realized that by not setting the id param of the option tag, it wasn't going to send the value of the dropdown box to my php script. I had this to start with: Code:
How Do You Do A CASCADE Delete In MySQL?
I'd like to delete a record and all its children records at one time. How do I do that? Can you, in one SQL statement, delete from table 1 where id = 3 delete from table 2 where id = 12 delete from table 3 where id = 12 ......
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:
Conditional Loop
I have one table, "players" that has player info including start season (year). I then have a table for each season with player stats, i.e. games played etc called stats200X where X is the year obviously. I have no problem with extracting data from the current year, but what I would like to do is get data from previous years too. I was thinking about doing something like: (year) - (startyear), which for example could be 3. I don't know where to begin, but I want to be able to loop though previous years so that, if tables exist of course, I could do select * from stats{Y -1} display select * from stats{Y -2} etc Would I need to hard code this or is there a way of doing this though a conditional loop?
Conditional Login..
I have a form with a username & password field along with 3 radio buttons. What I basically want to achieve is if radio button A is checked it will post the username & pass to a.php, If button B is checked it will post the username & pass to b.php and so on for button C.
Checkboxes,conditional
Basically I have what seems to be a very small problem but I am driving ny self mad trying to figure out what the problem is. Here is what I have: I have a form with two checkboxes: <input type="checkbox" name="medicalcheck" > <input type="checkbox" name="dentalcheck" > the form is posting the a php file, decision.php, that simple checks to see if the boxes have been checked and performs an operation in either case. Here is the code:
Once Conditional Causes Error, The Other Doesn't...why?
There are 2 if statements at the beginning of this code snippet. The one that is currently commented out works while the one that is not commented out yields this error Parse error: syntax error, unexpected '{' in C:xampphtdocsench2index4.php on line 106 I am just not seeing why. Code:
Conditional Structures
I am wondering about conditional structures and the depth of nesting allowed, if at all. For example I know I can do this: Code:
Conditional Form
I want to condtionally display an HTML form. I havnt got a clue how it can be done, I suppose its the same way as putting html tables in php, but I cant get it to work. Here is the condtion: <?php if (!empty($pk)) { And here is the form: <form action="google.php" method="GET" name="deleteForm" > <input type="hidden" name="pk" value="<? echo $pk;?>"> <input type="submit" value="Delete"> </form>
Conditional Third Expression In For Loop
Is it possible to make expr3 $i++ under one condition and $i-- under another? Instead of having the condition outside the loop and having two loops. Or I could just use a while loop, I guess.
Sessions + Conditional Include
I am having a little problem in trying to figure out why my session state is not expiring after I close the browser window. Having been used to the ASP way of doing things I am trying to get my head around this slightly different method of handling sessions in PHP.... What happens is that I log on to the site, do various things and then close it when I am finished. I return the next day to find that the 'logged in' menu is displayed first which shouldnt happen until you have logged in again. I assumed that the session was been stored as a cookie but wasnt been released after the session terminates by default, but found I was wrong when I deleted all my internet files and went back to the site. My code for the first page is as follows..
Conditional PHP Cookies; If Cookie = 1 Do This...
I've figured out cookies ... now I'm trying to combine them with if conditions. For cookie 'bandwidth1' I want to echo that it is set to 1 by the cookie to confirm this in the brower through regular html. My if/else statements don't seem to be working though...heres the code I have now. <?php setcookie("bandwidth1","0",time()+2592000,"/"); setcookie("bandwidth2","1",time()+2592000,"/"); setcookie("bandwidth3","2",time()+2592000,"/"); ?> <?php if (isset($_COOKIE["bandwidth1"])=="1") echo "Bandwidth is 1!"; else echo "Bandwidth is unknown"; elsif echo "Cookie was not set?"; ?>
MySQL Conditional Statement
What I am trying to do is kind of like an advanced search. Basically, I have three dropdowns, for this I am going to use the example books: Three dropdowns, which are 1) Author 2) Language 3) Type (Hardback or Paperback) Typical search: I want to get a list of all books written by STEPHEN KING, that are written in ENGLISH and that are HARDBACK ok fine, but what if I just want to search for ALL books by STEPHEN KING regardless of the language or the type of book?? Heres the SQL i would use for all 3 "search parameters": PHP Code:
Writing Conditional Statement
I'm trying write a conditional statement that updates the database in 1 of 2 ways depending on the values given. I'm only 2 weeks into learning PHP/MySQL so I realize the way I've written it out is probably sloppy and more inefficient than what it could be. I've just been winging it from examples and trial and error and have gotten everything working except for this. I'm not sure if I have my logic or syntax wrong. Application-specific details: This is a simple invoicing application. Every invoice is in either 1 of 3 states: - pending (default state when a new invoice is entered) - paid (state when invoice is paid in full) - partial (state when only partial payments have been made on the invoice) What I'm trying to do is this: 1. If a partial payment is made on an invoice, the status is set to 'partial' (this is working) 2. If the payment posted was the full amount of the invoice or the final amount needed to pay it in full, the status is set to 'paid' (this is not working) My processing logic works like this: 1. There is a total invoice amount stored in the invoice table represented by $total variable (working) 2. When payments have been made to that invoice (stored in the payments table), I show the remaining balance on their invoice by calculating the sum of those payments and subtracting them from the total (this is represented by the $diff variable and is working) 3. The part not working: When the remaining balance ($diff) minus the payment amount posted ($_POST['amount']) is equal to 0, the status is set to paid. PHP Code:
Conditional Statements And Loops
Not long ago I was asked to give PHP lections to some private IT school. I'm on second lection now, and will be teaching my :) students conditional statements (if..else and switch) and loops (while and for). That was my story, now the question. Can you give me an advise on some geeky use of those statements to stir up some enthusiasm in students.
Mutlipart And/or Conditional Form
I have a form that needs to have conditional statements, and I am not sure how to "fix" this. The existing form is split in two parts - the form, and the processor. I would think that I will need to combine them, but.. Anyways - what I need is somewhat simple - if a certain option (from a <select>) is chosen, force another field to be completed. I also have 2 other fields that if the radio button is set to YES, require new fields. Ideally, the optional fields would only be shown to the user IF they are required.
Conditional Select From Mysql
I have a mysql database which stores race data that I want to open up to users for viewing. I want the user to be able to select various subsets of the data according to the parameters: race, gender, age, and type (and maybe sometime, by name as well). This is BOTH a mysql question and a php one, as I ask for a more efficient solution (see bottom this post). Here is a snippet of how I am implementing the mysql statements to select only the exact subset of data. PHP Code:
Conditional Preg Match
The following bit of code does a preg match and does something if true (sets $browser to ppcie) Without using if then and else's how do I code it so it does not equal what it is testing for? So if it does not find ppc in the $agent then it does something else/sets it to something else? $agent = getenv("HTTP_USER_AGENT"); if (preg_match("/PPC/i", "$agent")) { $browser = 'PPCIE' }
Question On Conditional Statements
I'm a perl programmer and am trying to learn PHP. So far I have figured out most of the differences, but have not been able to find out how to do the following: When running through a loop, how can you test two separate conditions against the same $element of an array. For example, this is how I thought it would be done (similar to Perl), but it did not work: if (eregi("apple", $line) and (eregi("orange", $line) { do whatever; } Basically testing each line of an array to see if both the words "apple" and "orange" are present. Also, is there any equivalent to the following from Perl while running through a loop: next if (whatever conditions); last if (whatever conditions);
Help With Posting Conditional If Statement
I've tried scaling down a script to the bare minimum and it still is not working correctly. What I think should happen is that when the field app_fname is blank, that $hold_chk will get set to 1 and the 1st if statement will be executed. What actually happens is that when I hit submit, the form stays where it is, for example if the form where the submit button is located is on the form other.php, then when I hit submit this is where it stays. If I then hit the submit button a 2nd time, it post to the some.php form. I've tried this script without the conditional if(isset() and it works. I need to have the isset() otherwise the form displays all empty fields as soon as it loads, before the submit button is hit. <?php $holdchk = 0; if (isset($_POST['B1'])) { echo "<br><br><br>"; if (empty($_POST['app_fname'])) { $holdchk = 1; } if ($holdchk == 1 ){ echo "<form method="POST" action="some.php">"; } if ($holdchk == 0 ){ echo "<form method="POST" action="other.php">"; } } ?> <html> <head> </head> <form method="POST" action=""> When hit the submit button</font></b<input type="submit" value="Submit" name="B1"></p> </form> </body> </html>
Conditional Email Text To Hyperlink
I am trying to write a content management section for a web site. I have managed so far to use htmlarea to give users a basic, but user friendly interface by which to edit the page content. The user can add emails by symply typing john@example.com - IE automatically converts this to a hyperlink. The trouble is sometimes the users use plain text. I have been using the following line to convert plain text to a hyperlink: $pagetext=ereg_replace('[A-Za-z0-9_]([-._]?[A-Za-z0-9])*@[A-Za-z0-9]([-.]?[A-Za-z0-9])*.[A-Za-z]+', '<a href="mailto: ?subject=Email%20from%20web%20site"> |