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 ' ' so if $t is chosen i want the value of $s to be ' ' and $u to be ' ' and yes you've got it now if $u is chosen i want the value of $s and $t to be ' ' 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 Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Reproducing Chosen
I have a <select></select> field with many many options & the users selects an option & submits the form. now, if there was an error on the submission I am going to reload the form with the error & load all their answers into the fields. is there a quicker way to make their answer in the select field the selected option (<option value="blah" selected>blah</option>) other than looping through each & every field as they are output on the page to see if that was the answer they selected.
View Replies !
View Related
Switch - When 2 Possibillities Are Chosen?
I've started on php, finally, so I'm just experimenting a little with it. However I've ran into a little problem. Say I have a html form where I have two checkboxes. When you hit submit the information about which checkbox is selected gets passed over and displayed on the php page. However, when both boxes are checked I don't know what to do. I've tried with following, but that dosn't work: $hotel = $_POST['hotel']; switch($hotel){ case "1"; echo "<img src='original.jpg'/>"; break; case "2"; echo "<img src='qlimax.jpg'/>"; break; case "1 2"; echo "<img src='qlimax.jpg'/><br/><img src='original.jpg'/>"; }
View Replies !
View Related
Database On A Chosen Time
if there was a guide to making something change in a database on a certain time of the day, What i want to happen is that a user will start with 1 of something but every 15mins i want this to add 1 to what the user already has E.g. : Lets say the time was 12:00pm points = 1 and then at every 15 min intervals it would increase by 1 (12:15pm) points = 2 (12:30pm) points = 3 (.... 2:00pm) points = 9 And so on.
View Replies !
View Related
Display A Chosen Image
how to display a chosen image if an user forgets other information in a form. For regular input fields I use Code: <input name="checkEmail" type="text" value="<?php echo $_POST['checkEmail'];?>" maxlength="255" /> But for an image upload this doesn't work Code: <input type="file" name="photo" id="file" value="<?php echo $_POST['photo'];?>"/>
View Replies !
View Related
Cookies For Viewer Chosen Layout.
I am trying to create a user interaction experience on a web page that lets them choose there layout, but I do not want it to be just CSS based; I want it be PHP based. I am having trouble setting and erasing my cookies to make this work. I pretty sure the reason is because the code that checks for the cookie is in the top of the page and it is stopping the execution of the other if else condition. The thing is, that I am not sure exactly were to put this code at to make it work like I want it to. I tried to nest the if else condition, that checks for the cookie in the if else condition that checks for the layout, but that did not help. Code:
View Replies !
View Related
Form To Recognise What Answer The User Has Chosen
I need help with this form submission, i understand for submission is the easiest thing to do in php. But i just can't get this to work. Basically i have a form in which is a question. I have given users choice of 4 answers to this question in a dropdown menu. I just want the form to recognise what answer the user has chosen and put it into a table called support and the column 'category' in it. Code:
View Replies !
View Related
How To Send Form To Assigned Emails Depending On Chosen Opti
Lets say I have 5 different options in my combo box (5 different languages) English German Polish Italian Russian when one choses English, I want the email to be sent to english@english.com when one choses German, I want the email to be sent to german@german.com etc different otion chosen, different email address that the form is sent to. How to do that? Code:
View Replies !
View Related
Email Setup And Send To Multiple People Chosen In Form
I have a form designed that people complete, and can choose who they want the results to be emailed to. I think I have the script written correctly (for the most part) so it would work, but am not sure how to get the names you select from the drop down list, into the recipients. Do I need to set up a field in the DB to accomodate these. If so, can I have all the names go in one field, seperated by a comma, as there could be 15 - 20 names. When developing the mail script, and working on the "FROM" section, does it have to be a valid email address, or can it just be a name? I have a query written to get the email address, but I am having troubles getting it to work, because of where I need to put quotation marks, etc., it doesn't like it. Code:
View Replies !
View Related
Get The Values Chosen In The Drop Down Boxes To Correspond To Specifc Fields In A Database?
The purpose of this application: I need 2 combo boxes, one with months, and one with years. When the user chooses both a month and a year, a page is displayed with certain numbers that are retrieved from a database. Those numbers correspond to the specific month and year. For example, January 1998 produce "12", but February 2001 might display "73". So I guess I'm asking 2 questions. The first is just a general outline of how someone might go about doing this (to see if i'm on the right track in my thinking). The second, and more important question is for someone to please explain to me how do I get the values chosen in the drop down boxes to correspond to specifc fields in a database?
View Replies !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 Replies !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
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 !
View Related
Convert An IF ELSE Statement To A SWITCH CASE Statement?
How do I convert an IF ELSE statement to a SWITCH CASE statement? The switch case below doesn't work. $textlen = strlen($descr); if($textlen>10 && $textlen<50) { $completeness = 1; $deduct = 1000; } elseif($textlen>50 && $textlen<100) { $completeness = 2; $deduct = 500; } else { $completeness = 0; $deduct = 2000; } switch($textlen) { case >10 && < 50: $completeness = 1; $deduct = 1000; break; case >50 && < 100: $completeness = 2; $deduct = 500; break; default: $completeness = 0; $deduct = 2000; break;
View Replies !
View Related
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 !
View Related
Statement Within An Echo Statement
I have a series of fields being drawn from a db and displayed on the page. I would like to insert an image if the value of one of the fields == 1 otherwise no image I can't quite get my head around the right way to do this. I know the following syntax is wrong, but this is what I'd like it to do: PHP Code: echo "<p>" . $itemname . "<br />" . $itemdescription . "<br />" . (if ($showitem == 1) echo <img src="image.jpg">; ) . "</p>";
View Replies !
View Related
If Else Statement ?
Im currently writing some cart software and have run into a problem which i cant seem to get my head around ... i have been trying to solve this for around 3 weeks now with no luck, and thought someone here might be able to shed some light on this problem for me. Firstly it needs to check all products in the cart and take the one with the highest primary shipping cost, then subtract that one qty off the total amount. Then for all additional products or qty's it'll take the additional shipping cost of that product. If there are no additional products / qty's then it will use the primary shipping price from that product. I think thats how it goes, Here's a couple of real examples of how it should work: I have 3 products in my database: Product 1: DVD Player Product 1 Primary Shipping Cost: $20 (products_ship_price) Product 1 Additional Shipping Cost: $2 (products_ship_price_two) Product 2: Digital Camera Product 2 Primary Shipping Cost: $40 (products_ship_price) Product 2 Additional Shipping Cost: $1 (products_ship_price_two) Product 3: Cordless Phone Product 3 Primary Shipping Cost: $55 (products_ship_price) Product 3 Additional Shipping Cost: $3.50 (products_ship_price_two) If I buy 1 DVD player and 3 Digital Camera's, then the shipping price will be: $44 - $40 (highest primary shipping cost of the 2 products) + $1 + $1 (the other 2 qty's of the digital cameras) + $2 (for the 1 DVD player). If I buy 3 Cordless Phones, 2 DVD players and a Digital Camera, then the shipping price will be: $67 - $55 (highest primary shipping cost of all the products in the cart) + $3.50 + $3.50 (the other 2 qty's of the cordless phones) + $2 + $2 (the 2 qty's of the DVD players) + $1 (the Digital Camera). If I buy 2 Cordless Phones and 1 Digital camera, then the shipping price will be: $59.50 - $55 (highest primary shipping cost of all the products in the cart) + $3.50 (the remaining cordless phone in the cart) +1 (for the digital camera).
View Replies !
View Related
While In Another While Statement
I want to improve the display of my $result3. I'm sure I need to use another "while" statement inside this one but I don't want to create a infinite loop. The $result3 look's like that: ------------------------------------------------------- ¦norisk¦descris ¦nomesur ¦descmes ¦ ------------------------------------------------------- ¦A ¦high ¦1 ¦use harness ¦ ------------------------------------------------------- ¦A ¦high ¦7 ¦be carefull ¦ ------------------------------------------------------- ¦B ¦wet ¦3 ¦use boot ¦ ------------------------------------------------------- ¦B ¦wet ¦7 ¦be carefull ¦ -------------------------------------------------------- I'dont want to had another query( thise one involve already 3 tables). Here's the code I wrote: $result3 = mysql_query($sql2) or die("9err"); while ($array2 = mysql_fetch_array($result3)) { print ("<tr><td>"); print ($array2['descris']) or die("err17"); print ("</td><td>"); print ($array2['descmes']) or die("err17"); print ("</td></tr>"); } Of course, I don't want to see twice "high" and twice "wet" in the display but want to see all the measures for each risk.
View Replies !
View Related
If/else Statement
If you look at the script below how can i get the form to display if the confirm_cat is equal to "nil"? At the moment it only displays when confirm_cat isn't equal to 'yes'. Any ideas? PHP Code:
View Replies !
View Related
If Statement Within An If Statement
I am a complete novice with php scrip but I am wiling to learn. I am in need of some help, please. Can anyone sort this code out for me so that it works correctly and adjusts the price for the quantity selected on the front end. __________________________________________________ _____________ if(article_get_field('type')== 'Croclight Candle'){ article_set_field('item_number', 'CRC'); article_set_field('price', 6.99); } elseif(article_get_field('type')== 'Spray') { article_set_field('item_number', 'CRS'); article_set_field('size', ཮ml'); article_set_field('price', 6.99); } elseif(article_get_field('size')== ཋml') { article_set_field('item_number', 'CRS'); article_set_field('type', 'Spray'); article_set_field('price', 2.99); } elseif(article_get_field('type')== 'Roll-on') { article_set_field('item_number', 'CRO'); article_set_field('size', ཮ml'); article_set_field('price', 6.99); } __________________________________________________ ______________
View Replies !
View Related
If Statement In Url
I want it to run an if statement to see if you are on that page or not and if you are then it will set that link's class to active. If not, doesn't do anything. Here is what I had to do in my previous site, and I can't get it to work on the new one, could someone assist me? Code:
View Replies !
View Related
An IF Statement
if (!isset($_SESSION['admin'])) { include ('./includes/header_admin.html'); } else { include ('./includes/header.html'); }; In one of my tables, there is a column with the title admin and in the column one member will have admin in the column. When the person logs in, there is a few session variables set up. Session admin is one of the variables. I am using this so that when the person who has admin "privileges" they will see a different header which is used for nav on my site. Right now everyone is getting the header.html no matter what it says in the admin column.
View Replies !
View Related
If Statement!
PHP Code: if ($EventHeadlinerName == "Nascar Nextel Cup Series") && ($CategoryName == "auto racing") { header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.mysite.com/nascar.html"); } I am having a brain fa$#$t
View Replies !
View Related
Img Src Within A Statement?
I have a database with 2 boolean fields, and i want an image to display in the repeat region table if the value in that table is 1. At the moment, they're being displayed regardless, and the extra space that both images are taking up in dreamweaver makes it that the gap between the entries in the rows are huge. Code:
View Replies !
View Related
|