Jump to content

Search the Community

Showing results for tags '#chained'.

  • 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

Found 1 result

  1. Hey! Im trying to do a chained select dropdown. 1 dropdown decides what should be shown in the second one...i think you all are familiar with this. Anyway..im following this guide: http://www.yourinspirationweb.com/en/how-to-create-chained-select-with-php-and-jquery/ But something is wrong, i cant get it to work properly. My first dropdown is populating correct, but the second one is not working. If i choose something in the first dropdown, the second one just stops at "wait...". I think the problem is somewhere in add_project.php, but im not sure. Here is my code: add_project.php: <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("select#category").change(function(){ var id = $("select#category option:selected").attr('value'); $.post("select_type.php", {id:id}, function(data){ $("select#type").html(data); }); }); }); </script> <?php include "select.class.php"; ?> <form id="select_form"> Choose a category:<br /> <select id="category"> <?php echo $opt->ShowCategory(); ?> </select> <br /><br /> choose a type:<br /> <select id="type"> <option value="0">choose...</option> </select> <br /><br /> <input type="submit" value="confirm" /> </form> <div id="result"></div> select.class.php: <?php class SelectList { public function ShowCategory() { $sql = mysql_query("SELECT * FROM `projectCategory`"); // $res = mysql_query($sql,$this->conn); $category = '<option value="0">choose...</option>'; while($row = mysql_fetch_array($sql)) { $category .= '<option value="' . $row['categoryId'] . '">' . $row['categoryName'] . '</option>'; } return $category; } public function ShowType() { $query = mysql_query("SELECT huvudProjectId, huvudProjectName FROM `huvudProject` WHERE `categoryProject` = categoryId=$_POST[id]"); $type = '<option value="0">choose...</option>'; while($row = mysql_fetch_array($query)) { $type .= '<option value="' . $row['huvudProjectId'] . '">' . $row['huvudProjectName'] . '</option>'; } return $type; } } $opt = new SelectList(); ?> select_type.php: <?php include "select.class.php"; echo $opt->ShowType(); ?> Hope someone can help me with this! I've tried SO many hours but I cant find the problem.
×
×
  • 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.