Jump to content

problem in selecting username in combobox


a65

Recommended Posts

why i am not getting a combobox againt usename and also it is showing Undefined index: account_name at line 33

<?php

session_start();

if(isset($_SESSION['sname']))

{

 

 

$var1=$_SESSION['sname'];

mysql_connect("localhost","root","");

mysql_select_db("bank_acount");

$query="select * from user_info where username='".$var1."'";

 

$result=mysql_query($query);

 

$row=mysql_fetch_assoc($result);

 

?>

<form method="post" action="admin_control.php">

 

<table><tr><td>username</td><td>

<?php

while($row=mysql_fetch_assoc($result))

{

?>

<select name="myusername"><option value="<?php echo($row['username']); ?>"><?php echo($row['username']); ?></option>

<?php

}

?>

</select></td></tr>

<tr><td>account name</td><td><input type="text" name="account_name"></td></tr>

<td><input type=submit name=submit></td><td><input type=reset></td></table>

<?php

 

$var2=$_POST['account_name'];

$query ="insert into account values('','$var1','$var2')";

 

$result=mysql_query($query);

}

else

{

echo("improper access");

}

?>

what is the problem in this line. it is not able to fetch values from user_info ?

<tr><td>username</td><td>

<?php

 

while($row=mysql_fetch_assoc($result))

{

?>

<select name="myusername"><option value="<?php echo($row['username']); ?>"><?php echo($row['username']); ?></option>

<?php

}

?>

</select></td></tr>

it is not able to fetch values from user_info ?

 

Adding a question mark to a statement doesn't make it a question. If you want help, you have to be descriptive. Your last post wasn't.

 

Also, please wrap your code in code tags. You can use the button that looks like this: <>

i am not able to fetch the values from user_info table and the code is

<tr><td>username</td><td>
<?php
while($row=mysql_fetch_assoc($result))
{
?>
<select name="myusername"><option value="<?php echo($row['username']); ?>"><?php echo($row['username']); ?></option>
<?php
}
?>
</select></td></tr>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.