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");

}

?>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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: <>

Edited by haku
Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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