Jump to content

Search the Community

Showing results for tags 'drop down menus'.

  • 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. Issue: I’m missing something with my code to receive values from 2 different drop down menus from another form via post. Description: I have a php page with 2 drop down menues. These are populated from a MySql DB: location and jobtype. I’m trying to send the selected values from each to a new form to run a query. My first test is to make sure I'm getting the values, then I can code that to a query, but it looks like I'm only getting the last value. Below is the code on the sending from the form and the receiving php page. Also the error I’m seeing. I’m pretty new at this (a couple weeks or so) so I’m sure this is something simple I’m missing.. thanx Sending form: <form action="job_listing.php" method="post" > <table id="structure"> <tr> <td id="navigation"> <h4>Search Job Openings:</h4> Location: <br /> <?php //Get the data from DB $location_set = get_all_jobinfo(); //Actual query: SELECT location as location, jobtitle as jobtitle FROM jobs; if(!$location_set){ die("Database query Failed: " . mysql_error()); } echo "<select name='location'>"; //Loop thru the array and get the 'location' value while ($location = mysql_fetch_array($location_set)){ echo "<option value='" . $location['location'] . "'>" . $location['location'] . "</option>"; } echo "</select>" ?> <br /> <br /> Job Title: <br /> <?php $jobtitle_set = get_all_jobinfo(); //Actual query: SELECT location as location, jobtitle as jobtitle FROM jobs; if(!$jobtitle_set){ die("Database query Failed: " . mysql_error()); } echo "<select name='location'>"; //Loop thru the array and get the 'location' value while ($jobtitle = mysql_fetch_array($jobtitle_set)){ echo "<option value='" . $jobtitle['jobtitle'] . "'>" . $jobtitle['jobtitle'] . "</option>"; } echo "</select>" ?> </p> <input type="submit" name="submit"/> </td> <td id="page"> <h1>Adding text</h1> </td> </tr> </table> </form> Receiving PHP page <td id="page"> <?php /* Get imported values */ if(!isset($_POST['location'])){ echo "Location is not set"; echo "<br />"; }else { $location = $_POST['location']; echo "Location: " . $location; echo "<br />"; } if(!isset($_POST['jobtitle'])){ echo "Job Title is not set"; echo "<br />"; }else { $jobtitle = $_POST['jobtitle']; echo "Job Title: " . $jobtitle; echo "<br />"; } ?> </td> Result: Is attached image
×
×
  • 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.