Jump to content

Search the Community

Showing results for tags 'dropdown'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I have a function that builds an array an works great. Form <?php $name = 'logWeather'; $options = array( 'Fair', 'Windy', 'Rainy','Stormy'); $selected = $logWeather; echo dropdown( $name, $options, $selected ); ?> Function <?php function dropdown( $name, array $options, $selected) { /*** begin the select ***/ $dropdown = '<select name="'.$name.'" id="'.$name.'">'."\n"; $selected = $selected; /*** loop over the options ***/ foreach( $options as $key=>$option ) { /*** assign a selected value ***/ $select = $selected==$key ? ' selected' : null; /*** add each option to the dropdown ***/ $dropdown .= '<option value="'.$key.'"'.$select.'>'.$option.'</option>'."\n"; } /*** close the select ***/ $dropdown .= '</select>'."\n"; /*** and return the completed dropdown ***/ return $dropdown; } ?> This works perfectly to edit a dropdown built from an array, but I am trying to add in a little more functionality. How can I add in a hidden value and a displayed value ex in html <select name="logSeaCondition"> <option value="1">0-1 feet</option> <option value="4">2-4 feet</option> <option value="7">5-7 feet</option> <option value="10">8-10 feet</option> <option value="13">11-13 feet</option> <option value="16">14-16 feet</option> <option value="19">17-19 feet</option> <option value="21">20+ feet</option> </select> Can I possibly pass in an associative array and use value as key and echo the item in the array?
  2. Hi! I have question about Select Options from dropdown Options selection and selection is image with hover text on image! Ex: Like if you register on some forum and select own country from dropdown selection, and in forum viewthread shows your country with flag image somewhere above or up avatar. That i mean! Example picture: I working on my project "Film DB Liberty" what based on Movie DataBase mdb1987 CMS! Let me explain a bit: I want, if i add new movie to DB i have options select on Dropdown list "DVD" or "Blu-ray" and i select in list ex "DVD" it show in my main DB page like this format: Film Format: (and on image show hover text "Owns DVD"!) There is serval files what need to be mod, files codes i attached to that post! Image files what i want use is here... Blu-ray - http://films.jomppaspace.net/img/blu_ray_logo_small.png DVD - http://films.jomppaspace.net/img/dvd_logo_small.png Making that simple, i find dropdown code where is image as a selection but i do not know how but that in to my code! Please help me someone who knows better PHP code than me,woult extrem grateful if someone can modify code! (Agree also pay little for that!) Have skype and steam, pm me if you want add me! Hope you understand my question, sorry for poor english! Kind regards Elari add.php.txt add1.php.txt delete.php.txt delete1.php.txt edit.php.txt edit1.php.txt edit2.php.txt functions.php.txt index.php.txt
  3. Is there a better way to load table values into drop down menus? Basically I have 3 different drop down options which need to have data loaded into them from the same table in a database. Here is what I have so far. It works but I feel like there must be a better way to make this happen. <?php include("connect.php"); mysql_connect("$server", "$username", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); // HEADER INCLUDE include("header.php"); echo "<br/><br/>"; echo "<form action='add-record2.php' method='post'>"; // GET ALL DATA FOR "LOCATION" FROM "ADMIN" TABLE $location = mysql_query("SELECT Location FROM admin") or die(mysql_error()); echo "Location:"; echo "<select name='location'>"; while($row = mysql_fetch_array( $location )) { echo "<option value='". $row['Location'] ."'>"; echo $row['Location']; echo "</option>"; } echo "</select><br/> Task Description: <textarea rows='4' cols='50' name='task'></textarea><br/> Responsibility: <select name='responsibility'>"; // GET ALL DATA FOR "RESPONSIBILITY" FROM "ADMIN" TABLE $responsibility = mysql_query("SELECT Responsibility FROM admin") or die(mysql_error()); while($row = mysql_fetch_array( $responsibility )) { echo "<option value='". $row['Responsibility'] ."'>"; echo $row['Responsibility']; echo "</option>"; } echo "</select><br/> Type: <select name='type'>"; // GET ALL DATA FOR "TYPE" FROM "ADMIN" TABLE $type = mysql_query("SELECT Type FROM admin") or die(mysql_error()); while($row = mysql_fetch_array( $type )) { echo "<option value='". $row['Type'] ."'>"; echo $row['Type']; echo "</option>"; } echo "</select><br/> Frequency(days): <input type='text' name='frequency'> <input type='submit'> </form>"; // END OF FORM ?> Thanks John
  4. Hi, This is a screenshot of the script I'm trying to finish: A simple page, with an upload box, upload button, dropdown menu with directories, text box and a Create button. I can't see what's wrong in the code, as the folder is not getting created. What I'm trying to do is, when the 'Create' button is clicked: Get path from drop down menu Get text from text box Create a new folder in the selected directory (from drop down menu) with the name being the value from the textbox. This is the code: <?php include("login.php"); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>FileStore - Upload Files</title> <link rel="stylesheet" href="./CSS/style.css" type="text/css" media="screen, projection" /> </head> <body> <div id="wrapper"> <header id="header"> <div id="header-content"> <strong><h1>FileStore</h1></strong> Upload multiple files at once! </div> <div class="login-info" > <?php if ($isLoggedin === false) { echo ' <form action="" method="POST"> Username: <input name="username" > Password: <input type="password" name="password" size="8"> <input type="submit" name="submit" value="Login"> </form>'; echo "<p align='right'>You are not logged in.</p>"; echo "<b><a href='registration.php'>Register</a></b>"; }else{ echo $welcomeMsg; } ?> </div> </header><!-- #header--> <section id="middle" align="center"> <div id="container"> <br><br> <div id="content"> <strong><h1>Upload files</h1></strong><br><br> <div id="upload-file" > <form action="" method="post" enctype="multipart/form-data"> <input type="file" value="" name="upload[]" multiple> <button type="submit">Upload!</button> </form> <form action="" method='post' > <select name="myDirs"> <option value="" selected="selected">Select a folder</option> </form> <?php include("dbConfig.php"); global $userid; global $up_path; global $sPath; $Username = $_SESSION["username"]; $sql = "SELECT UserID FROM users WHERE Username = '".$Username."'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $userid = $row['UserID']; } $sPath = realpath("./files/" . $userid ); if (!file_exists($sPath)) { mkdir($folder_path, 0777, true); chmod($folder_path, 0777); } if (chdir($sPath)) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($sPath, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST); foreach($iterator as $file) { if($file->isDir()) { echo '<option value="'.$file.'">'.$file."</option>\n"; } } echo var_dump($file); } echo "<form action='' method='post' name='dircreation'>"; echo "<input type='text' name='newDir' > "; echo "<input type='submit' value='Create'>"; echo "</form>"; if(isset($_POST['dircreation'])) { $selected_path = $_POST["myDirs"]; $newDir = $_POST["newDir"]; //$fPath = realpath($sPath. "/" . $file . "/"); $folder_path = $selected_path . "/" . $newDir . "/" ; var_dump($folder_path); if (!file_exists($folder_path)) { mkdir($folder_path, 0777, true); chmod($folder_path, 0777); echo "Folder" . $newDir . "created."; echo "Redirecting to upload page.."; // header( 'Location: upload.php' ) ; } else { echo "Error creating " . $newDir; } } else if (isset($_POST['upload[]'])) { $error_message[0] = "Unknown problem with upload."; $error_message[1] = "Uploaded file too large (load_max_filesize)."; $error_message[2] = "Uploaded file too large (MAX_FILE_SIZE)."; $error_message[3] = "File was only partially uploaded."; $error_message[4] = "Choose a file to upload."; $vpath = strlen($userid); $upload_dir = './files/' . (string)$userid . '/'; $num_files = count($_FILES['upload']['name']); if (!file_exists($upload_dir)) { mkdir($sPath, 0777, true); chmod($sPath, 0777); } else { for ($i=0; $i < $num_files; $i++) { $upload_file = $upload_dir . urlencode(basename($_FILES['upload']['name'][$i])); if (@is_uploaded_file($_FILES['upload']['tmp_name'][$i])) { if (@move_uploaded_file($_FILES['upload']['tmp_name'][$i], $upload_file)) { //Great success... echo basename($upload_file) . " has been uploaded. <br>"; //$content = file_get_contents($upload_file); //echo $content; } else { print $error_message[$_FILES['upload']['error'][$i]]; } } else { print $error_message[$_FILES['upload']['error'][$i]]; } } } } ?> </div> </div><!-- #content--> </div><!-- #container--> <aside id="sideLeft"> <div id="menu-x" align="center"><br> <strong>Menu</strong><br><br> <div class="menu"> <ul> <li><a href="index.php">Home</a></li> <li><a href="upload.php">Upload</a></li> <li><a href="files.php">Files</a></li> <li><a href="about.php">About</a></li> <li><a href="help.php">Help</a></li> <li><a href="#">Logout</a></li> </ul> <br style="clear:left"/> </div> </div> </aside><!-- #sideLeft --> </section><!-- #middle--> <footer id="footer"> <strong>FileStore:</strong> A CMT 3315 Project by Brian Livori </footer><!-- #footer --> </div><!-- #wrapper --> </body> </html>
  5. Hello, Just need to figure out how to open a pdf from submit button, once the selection is made. Here is the link to the page: http://www.matrix.matrixprovenpos.com/test/index.php I am a very new newbie, but I know it's possible. Thanks for any help.
  6. Good afternoon everyone, and happy holidays! Although my membership might not qualify as "new" to this forum, I've never used my account here before but today I think I finally found a reason to! I'm trying to exclude four (4) values from array, which will then echo the remaining values into a drop-down box on a form. Here is the contents of the array: Array ( [0] => stdClass Object ( [id] => 22 [icao] => CYQM [name] => Greater Moncton International Airport - CHARTER [country] => Canada [lat] => 46.1122 [lng] => -64.6786 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [1] => stdClass Object ( [id] => 19 [icao] => EINN [name] => Shannon International Airport - CHARTER [country] => Ireland [lat] => 52.702 [lng] => -8.92482 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [2] => stdClass Object ( [id] => 16 [icao] => KAUS [name] => Austin-Bergstrom International Airport [country] => United States [lat] => 30.1945 [lng] => -97.6699 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [3] => stdClass Object ( [id] => 9 [icao] => KDEN [name] => Denver International Airport [country] => United States [lat] => 39.8583 [lng] => -104.667 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [4] => stdClass Object ( [id] => 2 [icao] => KLAS [name] => McCarran International Airport [country] => United States [lat] => 36.0827 [lng] => -115.154 [hub] => 1 [fuelprice] => 0 [chartlink] => ) [5] => stdClass Object ( [id] => 5 [icao] => KLGB [name] => Long Beach Airport [country] => United States [lat] => 33.8175 [lng] => -118.152 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [6] => stdClass Object ( [id] => 14 [icao] => KOAK [name] => Metropolitan Oakland International Airport [country] => United States [lat] => 37.721 [lng] => -122.222 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [7] => stdClass Object ( [id] => 10 [icao] => KPDX [name] => Portland International Airport [country] => United States [lat] => 45.5887 [lng] => -122.598 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [8] => stdClass Object ( [id] => 3 [icao] => KPHX [name] => Phoenix Sky Harbor International Airport [country] => United States [lat] => 33.4359 [lng] => -112.01 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [9] => stdClass Object ( [id] => 12 [icao] => KRNO [name] => Reno/Tahoe International Airport [country] => United States [lat] => 39.4991 [lng] => -119.768 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [10] => stdClass Object ( [id] => 4 [icao] => KSAN [name] => San Diego International Airport [country] => United States [lat] => 32.7334 [lng] => -117.188 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [11] => stdClass Object ( [id] => 17 [icao] => KSAT [name] => San Antonio International Airport [country] => United States [lat] => 29.5338 [lng] => -98.47 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [12] => stdClass Object ( [id] => 6 [icao] => KSEA [name] => Seattle-Tacoma International Airport [country] => United States [lat] => 47.449 [lng] => -122.309 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [13] => stdClass Object ( [id] => 8 [icao] => KSFO [name] => San Francisco International Airport [country] => United States [lat] => 37.6188 [lng] => -122.376 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [14] => stdClass Object ( [id] => 15 [icao] => KSJC [name] => San Jose International Airport [country] => United States [lat] => 37.3619 [lng] => -121.929 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [15] => stdClass Object ( [id] => 11 [icao] => KSLC [name] => Salt Lake City International Airport [country] => United States [lat] => 40.7884 [lng] => -111.978 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [16] => stdClass Object ( [id] => 7 [icao] => KSMF [name] => Sacramento International Airport [country] => United States [lat] => 38.6952 [lng] => -121.592 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [17] => stdClass Object ( [id] => 13 [icao] => KTNT [name] => Dade-Collier Training Airport - CHARTER [country] => United States [lat] => 25.862 [lng] => -80.8967 [hub] => 0 [fuelprice] => 0 [chartlink] => ) [18] => stdClass Object ( [id] => 18 [icao] => LTAI [name] => Antalya International Airport - CHARTER [country] => Turkey [lat] => 36.8987 [lng] => 30.8005 [hub] => 0 [fuelprice] => 0 [chartlink] => ) ) 1 As you can see, it's one (1) array that's broken up into a separate stdClass Object() array of some sort. My goal here is to exclude the following [id] values from the set of arrays above: 13, 18, 19, 22 The problem is that each array key (ex. [1], [2], [3]) from the first array will change when the contents of the array is increased over time. Therefore, I cannot simply exclude array keys [1], [2], [17], [18] Here's the code I'm working with now: <div id="depapttab"> <p>Select your departure airport:</p> <select id="depicao" name="depicao"> <option value="">Select All</option> <?php if(!$depairports) $depairports = array(); foreach($depairports as $airport) { if($depairports->id != array(13,18,19,22)) { echo '<option value="'.$airport->icao.'">'.$airport->icao.' - '.$airport->name.'</option>'; } } ?> </select> <input type="submit" name="submit" value="Find Flights" /> </div> I just don't know how to include that darn stdClass Object() in my if() statement. If someone could lend a hand, it'd be much appreciated! Thanks in advance!
  7. Hey there, Hoping someone can help me. I am trying to create a page on a wordpress site that will enable users to select 4 seperate fields from 4 drop down lists, hit a submit button and then be presented with search results from a MYSQL query based on their selections from the drop down list. I am a complete noob at php and MYSQL having not touched either since Uni. Please help out if you can. Here is the code. I have omitted the database connection details for obvious reasons. //Select City from Users table $queryCity = "SELECT City FROM Users"; $resultCity = mysql_query($queryCity) or die(mysql_error()); //Select AO from Users table $queryAO = "SELECT AO FROM Users"; $resultAO = mysql_query($queryAO) or die(mysql_error()); //Select Job from Users table $queryJob = "SELECT Job FROM Users"; $resultJob = mysql_query($queryJob) or die(mysql_error()); //Select Skills from Users table $querySkills = "SELECT Skills FROM Users"; $resultSkills = mysql_query($querySkills) or die(mysql_error()); //Create City dropdown list object $dropdownCity = "<select name='selectCity'>"; while($rowCity = mysql_fetch_assoc($resultCity)) { $dropdownCity .= "\r\n<option value='{$rowCity['City']}'>{$rowCity['City']}</option>"; } $dropdownCity .= "\r\n</select>"; //Create AO dropdown list object $dropdownAO = "<select name='selectAO'>"; while($rowAO = mysql_fetch_assoc($resultAO)) { $dropdownAO .= "\r\n<option value='{$rowAO['AO']}'>{$rowAO['AO']}</option>"; } $dropdownAO .= "\r\n</select>"; //Create Job dropdown list object $dropdownJob = "<select name='selectJob'>"; while($rowJob = mysql_fetch_assoc($resultJob)) { $dropdownJob .= "\r\n<option value='{$rowJob['Job']}'>{$rowJob['Job']}</option>"; } $dropdownJob .= "\r\n</select>"; //Create Skills dropdown list object $dropdownSkills = "<select name='selectSkills'>"; while($rowSkills = mysql_fetch_assoc($resultSkills)) { $dropdownSkills .= "\r\n<option value='{$rowSkills['Skills']}'>{$rowSkills['Skills']}</option>"; } $dropdownSkills .= "\r\n</select>"; //Print the drop downlists on the page echo "Please choose from the following fields below:"; echo "Location &nbsp&nbsp&nbsp"; echo $dropdownCity; echo "AO Level &nbsp&nbsp&nbsp"; echo $dropdownAO; echo "Occupation &nbsp&nbsp&nbsp"; echo $dropdownJob; echo "Skills &nbsp&nbsp&nbsp"; echo $dropdownSkills; ?> <form method="post" action="mypage.php"> <input type="submit" value="submit" name="Submit"> <?php //This code is for retrieving the results of the drop down selections after the submit button is clicked $selectionCity = $_POST["selectSkills"]; $selectionJob = $_POST["selectJob"]; //SQL query from retrieved results //SQL query from retrieved results $sqlresults = "SELECT * FROM Users WHERE City='"$selectionCity"' AND Job='"$selectionJob"'"; $sqlpost = mysql_query($sqlresults) or die(mysql_error()); echo $sqlpost; ?> I know the page looks horrible, trying to tackle one issue at a time and get this functional. Thanks for any and all help.
  8. Hi Everyone, I am fairly new in PHP Development but have used Wordpress for the last 2 years. I am currently modifying a plugin to suit the client's requirements. It is a Custom To-DO list plugin. You may check out my progress here : [Page on meshfun.com] The plugin I am modifying is WordPress › TaskFreak! Free " WordPress Plugins It is almost all the required features, just the feature of Creating Groups and assigning is absent. When a new task is created,an option of assigned to is present but that can assign task to ONLY ONE Person. It should be able to assign to multiple users. The whole data is stored in the database in 8-9 tables. The main table DO has a field called as user_ID as you can see in the image below. It is updated when a new task is created. It contains a number (User ID of person who is assigned the task) or left blank in case the task is not assigned to anyone. : I would like the ability to assign to multiple users instead of one. What would be the ideal way ? Create new table or store the number of people assigned as array ? If a new table is created, what will be the fields to be created ? Note I was not able to add images so please check out here to see couple of images I wanted to show you : http://www.quora.com/Need-help-in-Modifying-a-Wordpress-Plugin I understand that you guys are quite busy but if you guys can atleast guide me on how to proceed, it would be great ! Thanks, Shalabh Here is the code which displays dropdown menu in the front end (taskfreak/inc/views/front/edit.php) <li> <label for="tfk_user_id"><?php _e('Assigned to', 'taskfreak') ?></label> <select name="user_id" id="tfk_user_id"> <option value="">—</option> <?php foreach ($this->users as $user): ?> <option value="<?php echo $user->ID ?>"<?php if ($this->pid && $this->data->get('user_id') == $user->ID) { echo " selected"; } ?>><?php echo $user->display_name ?></option> <?php endforeach; ?> </select> <?php echo $this->data->errors['user_id'] ?> </li> UPDATE : One gentleman suggested me to create a table with the following SQL COde : CREATE TABLE `task_user` ( `task_id` int(11) unsigned NOT NULL, `user_id` int(11) unsigned NOT NULL, `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'status field is optional', UNIQUE KEY `task_user` (`task_id`,`user_id`,`type`) USING BTREE, KEY `task_id` (`task_id`), ) CHARSET=utf8 But I am still not able to convert the display into multiple checkboxes.
×
×
  • 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.