a65 Posted January 7, 2013 Share Posted January 7, 2013 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"); } ?> Quote Link to comment Share on other sites More sharing options...
joel24 Posted January 7, 2013 Share Posted January 7, 2013 (edited) Check you're posting the required data before echoing, Have a look at isset() if (isset($_POST['account_name'])) { //echo } Edited January 7, 2013 by joel24 Quote Link to comment Share on other sites More sharing options...
a65 Posted January 7, 2013 Author Share Posted January 7, 2013 here i have to insert these values into account after using if(isset($_POST['account_name'])) echo($account_name); still it gives Undefined index: account_name online 34 Quote Link to comment Share on other sites More sharing options...
haku Posted January 7, 2013 Share Posted January 7, 2013 $_POST['account_name'] != $account_name. Quote Link to comment Share on other sites More sharing options...
a65 Posted January 7, 2013 Author Share Posted January 7, 2013 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> Quote Link to comment Share on other sites More sharing options...
haku Posted January 7, 2013 Share Posted January 7, 2013 (edited) 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 January 7, 2013 by haku Quote Link to comment Share on other sites More sharing options...
a65 Posted January 7, 2013 Author Share Posted January 7, 2013 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> Quote Link to comment Share on other sites More sharing options...
haku Posted January 7, 2013 Share Posted January 7, 2013 So when you try to fetch them, I'm assuming that smoke comes out of your monitor and you aren't able to see the screen anymore? If so, I think you have faulty wiring. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.