By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

combobox problems

P: 18
new to php.....

i hav a login page? after validaing loginname and password second page comes...... i access his loginname through url which is ->http://localhost/aa/vtr/add/add_ps2.php?name=div,in second page i hav three combobox (unit,achivements,crop) these comboxbox dynamically fill values from mysql database depends on loginname but when i am selecting unit comboxbox value browser url changed to http://localhost/aa/vtr/add/add_ps2.php because of this other controls in my form show nothing or null.
from rohit
Sep 23 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 296
Hey mate,

Can you upload some code?

Sep 23 '08 #2

P: 18
loginpage code->
<input name="txtusername" id="txtusername" type="text" width="70px" class="style23"/>
<input name="txtpass" type="password" width="70px" class="style23"/>
button here...................

i made a mid page for validating user code is below---

$dbcon1=new Dbcon();
mysql_connect($host,$user,$pass1) or die("could not connect:".mysql_error());

$query="select UserName,Password FROM user where UserName='$divname' and Password='$pass'";
$result = mysql_query($query);
if($row = mysql_fetch_array($result,MYSQL_ASSOC))
header("Location: homepage.php?name=$divname");

after validating... second page come in this page i made some combobox. ----

$res = mysql_query("SELECT distinct untcode FROM div_gp where division='$division'")or die("Invalid query: " . mysql_query());
echo '<select class="style23" id="unt" name="unt" onchange="sel()">';
echo '<option value="">Select..</option>';
while ($row = mysql_fetch_array($res))
$va1 = $row['untcode'];
if(isset($_POST['unt']) )
echo "<option value='$va1' selected>$va1</option>";
echo "<option value='$va1'>$va1</option>";
echo "<option value='$va1'>$va1</option>";
echo '</select>';
onchange this combobox value corresponding value fill to other combobox but browers url there anyway when in mypage whenever i change comboxbox value my browser url did not effected.
Sep 24 '08 #3

P: 9

On the page where you have your combobox, is that all the code for that page? What does 'sel()' do?

I would recommend that if want to fill the values of the other combobox, use an AJAX script or POST the data into the same page.

Sep 24 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.