Hi All,
What I am trying to do is 2 dependent drop down boxes and when user selects submit button the values are to be passed to the database to run a insert query.
Right now, I am stuck with the second drop down box because it does not show up the values based on the selection in the first drop down box.
Important point here is " My second drop down box displays columns from a single row(returned from second query)"
Attached is my code please do suggest me the required changes to make and also I pasted the code here,
<?php
include("../include/dbcommon.php");
if(isset($_GET["country"]) && is_numeric($_GET["country"]))
{
$country = $_GET["country"];
$emp_number=$country;
echo($emp_number);
}
if(isset($_GET["state"]) && is_numeric($_GET["state"]))
{
$state = $_GET["state"];
$emp_positionheld=$state;
echo ($emp_positionheld);
}
?>
<script language="JavaScript">
function autoSubmit()
{
var formObject = document.forms['theForm'];
formObject.submit();
}
</script>
<form name="theForm" method="get">
<select name="country" onChange="autoSubmit();">
<option value="null"></option>
<?php
//POPULATE DROP DOWN MENU WITH Employee Names
$sql = "SELECT EmployeeNumber,LastName FROM employees";
$countries = mysql_query($sql,$conn);
while($row = mysql_fetch_array($countries))
{
echo ("<option value="$row[EmployeeNumber]" " . ($country == $row["EmployeeNumber"] ? " selected" : "") . ">$row[LastName]</option>");
}
?>
</select>
<?php
if($country != null && is_numeric($country) )
{
?>
<select name="state" onChange="autoSubmit();">
<option value="null"></option>
<?php
//POPULATE DROP DOWN MENU WITH Job Position helds For a Given Employee
$sql = "SELECT * FROM employee_positionheld WHERE EmployeeNumber = $country ";
$states = mysql_query($sql);
$row = mysql_fetch_array($states);
for($k=1;$k<=6;$k++)
{
echo("inside for");
$temp[$k]='Position held' . ' '.$k;
$queryvar=$temp[$k];
//echo($queryvar);
echo ("<option value="$row[$queryvar]" " . ($state == $row[$queryvar] ? " selected" : "") . ">$row[$queryvar]</option>");
}
?>
</select>
<?php
}
?>
</form>
MY EMPLOYEE_POSITION HELD TABLE looks like this
EmployeeNumber Employee Name Position held 1 Position held 2 Position held 3 Position held 4 Position held 5 Position held 6
34550 Suraj Entryleveltech1 Seniortech1 programmer1 0 0 0 0
Filename and Line Number Custom Error
I have a class, with a method that accepts 2 parameters. I would like to output error messages. So, lets say a new file is created, and my class is used in that file. We will call that file test.php
insert/update functions for mysql, what do you think?
I am working on two really simple functions that automatically generate (and execute) insert and update mysql queries and I have some questions:Can there be any problems later on if functions treat
Curl & sessions PLS HELP
Hello,I have a problem with curl and sessions and i will try to explain the best i could.01. I want to download a file from (http://subdomain.example.com/name-13075.html) with curl.02. The problem is:
Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a new user when I'm not logged in. It should redirect me back to the login page but I get this
socket communication between c++/java and sending image
hi, i have a class in c++ called win32_sockserver which creates socket to java. i am trying to send image c++ to java and using the most basic method. i am sending image's rgb values as a string. But
Need help PLEASE
ok i have this warning showing upWarning: in_array() [function.in-array]: Wrong datatype for second argument in /home/lalala/public_html/attack.php on line 72the code i use Code: [Select]//same ip
php mail form text wont appear / javascript included
Guys/gals...I am running into a problem whereby I have a great piece of javascript code that mimicks multi-page forms (see www.mtsgroup.co.uk/multiPageForm.htm).....The problem is the php file wont
Can I call a class inside a function?
I have a class written in another file that handles my image resizing.Can I do this (php says I can't calling a non-existent class), but I know its there becuase the require doesn't fail aboveCode:
Hits this week counter
I have a counter on my site that tracks hits, IP's, etc. into a mySQL database. It also includes the date in the entry. The code I'm using, that's not working, to try and retrieve the amount of hits
Code Review - SQL and Insertion Attacks (Warning: Not for Newbs)
Hey guys,Its been a while, I know. Use to love coming here to answer peoples questions, but work and school have been keeping me too busy but do anything but lurk. I usually write all my code/apps by