Search the Community
Showing results for tags '_post'.
-
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
-
I've stored entries from a large form into an array, this array I now want to pass to the next page, but when using either "$_GET[ ]" or "$_POST[ ]", I just get in my array 'a','r','r','a','y', then the rest of the array is empty... I've followed all the documentation I can find, but nothing has worked so far; can anybody help? the variable is man[x], all the other variables from the form passed over, perhaps I've not got the syntax right for an array where i declare it in the second file? $man=$_POST['man'];