Jump to content

Search the Community

Showing results for tags 'dynamic'.



More search options

  • 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 (Dreamweaver, Zend, 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

Found 3 results

  1. Hi all, I was hoping you could point me in the right direction, I have 2 questions. 1. I want to have an option drop down which uses the array of a returned sql query. I have the following code which uses onchange to submit the selection, how do I use the mysql_fetch_array($result1) to give a list of the two selected columns in the $Site=array() bit. 2. The selected result will be used in more SQL select statements, so once a site from the list is selected the relevant data from other tables will be displayed using e.g. select person from people [some inner join statement] where site="site 1"; Therefore the $_POST value must be available to be passed to other queries once selected. Thanks for any help, I still feel like a noob, but I'm getting there. Gary <?php include 'header.php'; ?> <div class='container'> <?php include 'menu.php'; ?> <?php include 'connect.php'; ?> <?php $sql1="SELECT Sites.Site_ID, Sites.Site_name_1 FROM `Sites`"; $result1=mysql_query($sql1); ?> <?php function get_options() { $site=array('Site 1'=>'Site 1', 'Site 2'=>'Site 2', 'Site 3'=>'Site 3'); $options=''; while(list($k,$v)=each($site)) { $options.='<option value="'.$v.'">'.$k.'</option>'; } return $options; } if(isset($_POST['site'])) { echo $_POST['site']; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <select name="site" onchange="this.form.submit();"> <?php echo get_options(); ?> </select>
  2. This is the code for a dynamic dropdown list which i use to create a record. It works. But i find it slow when updating a record. It takes time to load the cities dropdown data. I am wondering, is there a more efficient way to do this dropdown so it loads the data more quickly? <script> function getCity(val) { $.ajax({ type: "POST", url: "../snippets/get_cities.php", data:'state_id='+val, success: function(data){ $("#city-list").html(data); } }); } function getState(val) { $.ajax({ type: "POST", url: "../snippets/get_states.php", data:'country_id='+val, success: function(data){ $("#state-list").html(data); } }); } function selectCountry(val) { $("#search-box").val(val); $("#suggesstion-box").hide(); } </script> <fieldset> <label>Location:</label><br/> <select name="country" id="country-list" onChange="getState(this.value);"> <option value="">Select Country</option> <?php $get_countries = $db->prepare("SELECT * FROM countries2"); $get_countries->execute(); $result_countries = $get_countries->fetchAll(PDO::FETCH_ASSOC); if(count($result_countries) > 0) { foreach($result_countries as $row) { $get_country_id = trim($row['id']); $get_country_name = trim($row['name']); ?><option value="<?php echo $get_country_id; ?>" <?php if($record_country_id == $get_country_id) { echo 'selected'; }; ?>><?php echo $get_country_name; ?></option><?php } } ?> </select> <select name="state" id="state-list" onChange="getCity(this.value);"> <option value="">Select State/Province</option> <?php $get_states = $db->prepare("SELECT * FROM states"); $get_states->execute(); $result_states = $get_states->fetchAll(PDO::FETCH_ASSOC); if(count($result_states) > 0) { foreach($result_states as $row) { $get_state_id = trim($row['id']); $get_state_name = trim($row['name']); ?><option value="<?php echo $get_state_id; ?>" <?php if($record_state_id == $get_state_id) { echo 'selected'; }; ?>><?php echo $get_state_name; ?></option><?php } } ?> </select> <select name="city" id="city-list"> <option value="">Select City</option> <?php $get_cities = $db->prepare("SELECT * FROM cities"); $get_cities->execute(); $result_cities = $get_cities->fetchAll(PDO::FETCH_ASSOC); if(count($result_cities) > 0) { foreach($result_cities as $row) { $get_city_id = trim($row['id']); $get_city_name = trim($row['name']); ?><option value="<?php echo $get_city_id; ?>" <?php if($record_city_id == $get_city_id) { echo 'selected'; }; ?>><?php echo $get_city_name; ?></option><?php } } ?> </select> </fieldset>
  3. http://www.tirerack.com/content/tirerack/desktop/en/wheels.html See the window where it says "Shop by Vehicle"? Is there a script already out there that does the dropdown search by make/model/year? I am only looking for the front-end code; javascript/jquery code in particular.
×
×
  • 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.