Search the Community
Showing results for tags 'drop down list'.
-
Hello all, I am new in php and would like to help me in in code. I would like to implement a html form that will upload to my linux server some files, some info as well and will run a bash command. To be more clear, users will: Send to the linux server two files (I have done it). Select from a drop down list a specific directory, and once this specific directory has been selected to activate one other drop down menu with its childs. Send all those info to a bash script. For case b, assume that we have the following structure my_dir/cars/brand1 my_dir/cars/brand2 my_dir/cars/brand3 my_dir/motors/brand5 my_dir/motors/brand6 the first drop down list should list only cars and motors while the second only brand1, brand2, and brand3 if cars is selected or brand5 and brand6 if motors is selected. For case c, once the form is submitted, I would like the command: ./script.sh –a uploadedfile1 –b uploadedfile2 –c dropdown1 –d dropdpwn2 Any help is appreciated. Best,
-
Hello freinds, Here 1st dropdown list not holding its value... CAN U HELP ME... <body> <?php include "db_conexn.php"; ?> <form method="post" name="admin"> <select name="value1" onChange="this.form.submit();"> // 1Ste Drop Down Menu Starts here <?php $result = mysql_query("SELECT distinct(comp_name) from company"); echo("<option value=''>---Select Company Name---</option>"); if(mysql_num_rows($result)) { while($row = mysql_fetch_row($result)) { echo("<option value='$row[0]'>$row[0]</option>"); } } else { echo("<option value=''>No</option>"); } echo "</select>"; ?> <?php if(isset($_POST['value1'])){ // Checks if 1Ste Drop Down menu has a value. $value1=$_POST['value1']; ?> <select name="value2"> //2nd Drop Down Menu Starts here <?php $result = mysql_query("SELECT distinct(branch) from branch where comp_name='$value1'"); if(mysql_num_rows($result)) { while($row = mysql_fetch_row($result)) { echo("<option value='$row[0]'>$row[0]</option>"); } } else { echo("<option value=''>No Data</option>"); } echo "</select>"; ?> <?php }else{ echo "\n"; } ?> </form> </body> drop.php
-
Hi everybody, I am just learning to use the Confirm Box feature in Javascript. I have tried to add it onto HTML form's submit buttons and checkboxes without problem. But when I add it to a HTML drop down list the behavior is a bit different and unexpected. My code looks like this: <select name='mychoice' onclick='return confirm("Are you sure?");'> <option value='1' selected='selected'>Apple</option> <option value='2'>Orange</option> <option value='3'>Lemon</option> </select> When I select one choice (whether it is Apple or Orange or Lemon), the Confirm Box pops up as expected. The problem is, when I press Cancel, the original choice will not appear, unlike checkboxes. In other words, pressing OK and Cancel will lead to the same result. Is my code wrong, or is there any simple way to make the original choice re-appear when Cancel is pressed? Thanks, pengi.
-
Hello I am trying to insert values in my database from a dynamic drop down list. I have created the following program, its not given me any error message, but also its not inserting any record in database. Kindly check it and tell me where is the problem. I have also echo the fields which i am inserting in database, and all the fields are entering correctly in variables. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> </body> </html> <?php session_start(); if(isset($_SESSION['username'])) { include 'connect.php'; $select_query= 'Select * from category'; $select_query_run = mysql_query($select_query); echo " <form action='insert_product.php' method='POST' ></br> Product Name: <input type='text' name='product_name' /></br> Price : <input type= 'text' name= 'price' /></br> Description : <input type='text' name='description' />*Seperate by Comma</br> "; // Drop Down Display echo "<select name='category'>"; while ($select_query_array= mysql_fetch_array($select_query_run) ) { echo "<option value='".$select_query_array['category_id']."' >". htmlspecialchars($select_query_array["name"])."</option>"; } $selectTag= "<input type='submit' value='Insert' /></select></form>"; echo $selectTag; //Drop Down End! if(isset($_POST['product_name']) && isset($_POST['price']) && isset($_POST['description']) ) { echo $product_name = $_POST['product_name']; echo $price = $_POST['price']; echo $description = $_POST['description']; echo $category = $_POST['category']; //Problem Area $query= "insert into products (name, price, description, category_id ) VALUES( '$product_name', $price, '$description', $category )"; if($query_run= mysql_query($query)) { echo 'Data Inserted'; } else { 'Error In SQL'.mysql_error(); } } else { echo 'empty Field'; } } else { echo 'You Must Log in To View this Page!'; } ?>
-
Hi, I would like to populate a drop down list box on my php page. How can I simply put a drop down on this php page? Best Regards.