Jump to content

Search the Community

Showing results for tags 'dropdown menu'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 5 results

  1. Hello, I'm new to php, I don't really have much experience, just have used it in combination with dreamweaver. I'm tackling a new problem now. Basically, it's about a dropdown menu with pre-defined values. There are multiple dropdowns, having different value choices. People are supposed to be able to select more than one option and then search for the results. these should then be generated according to the selected values, or if no value is selected, ALL is shown. When the user clicks on search, the values create a msql query that will then be executed and the results shown on the page. I've been searching high and low for code ideas, but see different stuff everywhere I look, and none of the code seems to be what i want. Some people are using Javascript, some Ajax, or PHP. ideally, I want to use just php and sql Can someone point me in the right direction on how to tackle this problem, or maybe someone has some code ideas? Thanks in advance. Mio
  2. Hi, I hope you are well I have a dropdown menu and the next part of the form is checkboxes. I would like to make it so that what ever option you choose with the dropdown menu, must limit the amount of check boxes you can tick. So if you choose a package from the dropdown menu where you would like to play 2 courses, in the next part of the form you are only allowed to tick 2 courses from the tick boxes. So if you pick two courses, the other must fade out or some pop up message must appear to tell the user he can only choose two courses, or even after you hit the submit button it the error message can appear to choose the right amount of courses. Is this possible with PHP or is there some jQuery plugin that can do that. Thank you
  3. Hi guys, I would really appreciate some help with this code. How it works now is that it creates a drop down menu for date starting today and for the last 14 days. There is also a time drop down menu. Both correctly retain the selected values if the page is refreshed. Now in addition I need the following to work: 1. have the word "choose" as the displayed default menu item instead of the initial date and initial time values that show now. 2. secondly if a value is NOT chosen from either menu (and after hitting Submit button) I want the error to display similar to if other required fields are not filled in. It seems that because the default menu value IS already a day value, the script thinks that there is already a POST from these menus and will therefore not display the error which checks for each menu POST. <? echo $err_day; ?> <? echo $err_time; ?> Here's my script online: http://www.cmfsc.ca/forms/lostandfound-WORKING.php Below is the relevant code that needs to be tweaked somehow. Thanks!!! Ed <tr> <td>Date lost/found *</td> <td><select name="day"> <? date_default_timezone_set("America/Vancouver"); $startDay = mktime(); $endDay = mktime() - (14 * 24 * 3600); for ($i = $startDay; $i >= $endDay; $i = $i - 86400) { $thisDate = date('l F jS Y', $i); // nothing selected by default $selected = ''; // if the form is submitted. // Check that the posted value is the same as this value // if is the same set it to selected. if(isset($_POST['day']) && $_POST['day'] == $thisDate) $selected = ' selected'; // added the selected attribute here \ / print "<option value=\"$thisDate\"$selected>$thisDate</option>\n"; } ?> </select> </td> </tr> <tr> <td>Time lost/found *</td> <td><select name="time"> <? $startTime = mktime(9, 00, 0, 0, 0, 0); $endTime = mktime(20, 00, 0, 0, 0, 0); for ($i = $startTime; $i <= $endTime; $i = $i + 1800) { $thisTime = date('g:i a', $i); // nothing selected by default $selected = ''; // if the form is submitted. // Check that the posted value is the same as this value // if is the same set it to selected. if(isset($_POST['time']) && $_POST['time'] == $thisTime) $selected = ' selected'; // added the selected attribute here print "<option value=\"$thisTime\"$selected>$thisTime</option>\n"; } ?> </select> </td> </tr>
  4. Hey, i got another question. Ok so far i have a table called users (id, name, username, pass, type) and here is my coding so far.. <html> <head> <title> Login Form </title> </head> <body> <form method='post' action='login.php'> <table width='400' border='5' align='center'> <tr> <td align='center' colspan='5'><h1>Login Form</h1></td> </tr> <tr> <td align='center'>Username:</td> <td><input type='text' name='username' /></td> </tr> <tr> <td align='center'>Password:</td> <td><input type='password' name='pass' /></td> </tr> <tr> <td align='center'> <select name="type" id="type"> <option value="0 selected="selected">Select user type</option> <option value="admin">Admin</option> <option value="student">Student</option> </select> </tr> <tr> <td colspan='5' align='center'><input type='submit' name='login' value='Log In' /></td> </tr> </table> </form> </body> </html> <?php mysql_connect("localhost","root",""); mysql_select_db("student_attendance"); if(isset($_POST['login'])){ $username = $_POST['username']; $password = $_POST['pass']; $type = $_POST['type']; $check_user = "select * from users where username='$username', pass='$password' AND type='$type'"; $run = mysql_query($check_user); if(mysql_num_rows($run)>0){ echo "<script>alert('You are logged in')</script>"; } else { echo "<script>alert('username,password or user type is incorrect!')</script>"; } } ?> And when i viewed it looks like this.. http://i272.photobucket.com/albums/jj178/r1nk_2008/prob_zpsd907ed84.png So my questions are :- -how to make the select box option to the right side, below the password form ? -how to fix the error so that when i enter correct username, pass and type it says "you are login" ?
  5. Hello all! First, im very new to this forum.. and i'm really liking it! Second, i'm having this problem. I created this php dropdown menu allowing a user to select a specific phone make, model, color, size, and condition. However, when i run the script i only get the two makes i initialize within the code "Apple" and "Samsung." Can someone take a look at my code and see if its the issue? My back end looks like so: Database name: model MODEL_ID int(11) Key - Auto increment MAKE_ID int(11) MODEL_NAME varchar(30) Database name: color COLOR_ID int(11) Key - Auto increment MODEL_ID int(2) COLOR_NAME varchar(20) Database name: size SIZE_ID int(11) Key -Auto increment COLOR_ID int(2) SIZE_NAME varchar(40) Database name: con CON_ID int(11) Key -Auto increment SIZE_ID int(2) CON_NAME varchar(20) <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_custsqlmoo16 = ""; $database_custsqlmoo16 = ""; $username_custsqlmoo16 = ""; $password_custsqlmoo16 = ""; $custsqlmoo16 = mysql_pconnect($hostname_custsqlmoo16, $username_custsqlmoo16, $password_custsqlmoo16) or trigger_error(mysql_error(),E_USER_ERROR); ?> <?php $make = $model = $color = $size = $con = null; //declare vars $conn = mysql_connect('localhost'); $db = mysql_select_db('testing',$conn); if(isset($_GET["make"]) && is_numeric($_GET["make"])) { $make = $_GET["make"]; } if(isset($_GET["model"]) && is_numeric($_GET["model"])) { $model = $_GET["model"]; } if(isset($_GET["color"]) && is_numeric($_GET["color"])) { $color = $_GET["color"]; } if(isset($_GET["size"]) && is_numeric($_GET["size"])) { $size = $_GET["size"]; } if(isset($_GET["con"]) && is_numeric($_GET["con"])) { $con = $_GET["con"]; } ?> <script language="Javascript"> function autoSubmit() { var formObject = document.forms['theForm']; formObject.submit(); } </script> <form name="theForm" method="get"> <select name="make" onchange="autoSubmit();"> <option value="null"></option> <option value="1" <?php if($make == 1) echo " selected"; ?>>Apple</option> <option value="2" <?php if($make == 2) echo " selected"; ?>>Samsung</option> </select> <br><br> <?php if($make != null && is_numeric($make)) { ?> <select name="model" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH model FROM A GIVEN make $sql = "SELECT MODEL_ID, MODEL_NAME FROM model WHERE MAKE_ID = $make"; $model = mysql_query($sql,$conn); while($row = mysql_fetch_array($model)) { echo ("<option value=\"$row[MODEL_ID]\" " . ($model == $row["MODEL_ID"] ? " selected" : "") . ">$row[MODEL_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($model != null && is_numeric($model) && $make != null) { ?> <select name="color" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH COLORS FROM A GIVEN MAKE, MODEL $sql = "SELECT COLOR_ID, COLOR_NAME FROM color WHERE MODEL_ID = $model "; $color = mysql_query($sql,$conn); while($row = mysql_fetch_array($color)) { echo ("<option value=\"$row[color_ID]\" " . ($color == $row["COLOR_ID"] ? " selected" : "") . ">$row[color_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($color != null && is_numeric($color) && $make != null && $model != null) { ?> <select name="size" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH SIZES FROM A GIVEN MAKE, MODEL, COLOR $sql = "SELECT SIZE_ID, SIZE_NAME FROM SIZE WHERE COLOR_ID = $color "; $size = mysql_query($sql,$conn); while($row = mysql_fetch_array($size)) { echo ("<option value=\"$row[size_ID]\" " . ($size == $row["SIZE_ID"] ? " selected" : "") . ">$row[size_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($size != null && is_numeric($size) && $make != null && $model != null && $color != null) { ?> <select name="con" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH CONDITIONS FROM A GIVEN MAKE, MODEL, COLOR, SIZE $sql = "SELECT CON_ID, CON_NAME FROM CON WHERE SIZE_ID = $size "; $con = mysql_query($sql,$conn); while($row = mysql_fetch_array($con)) { echo ("<option value=\"$row[CON_ID]\" " . ($con == $row["CON_ID"] ? " selected" : "") . ">$row[CON_NAME]</option>"); } ?> </select> <?php } ?> </form> Thanks ahead of time!
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.