How to display values in HTML form by retriving from database through PHP

From: Date: Thu, 26 Jul 2001 12:24:09 +0000
Subject: How to display values in HTML form by retriving from database through PHP
Groups: php.general 
Request: Send a blank email to php-general+get-59725@lists.php.net to get a copy of this message
Hi! Dear friends, How to display the values in HTML FORM by retrieving the values from database. Please any one of u know suggest me. Thanks in advance. CODE(MODIFYUSER.PHP) ---------------------------------------------------------------------------- <?php // Connect to MySQL mysql_connect( 'localhost', 'balaji', 'pingpong' ) or die ( 'Unable to connect to server.' ); // Select database on MySQL server mysql_select_db( 'imac' ) or die ( 'Unable to select database.' ); ?> <HTML> <BODY background="imacbg1.gif"> <form method="POST" action="modifyuser.php"> <div align="center"> <center> <h2>Modify User</h2> <p> <script language="php"> $query = "SELECT * from employee WHERE emp_id='$user' "; // $user will come from post method $result = mysql_query($query)or die ( 'Unable to execute query.' ); </script> Employee No: <input type="text" name="emp_id" value="//here i want to assign $result->emp_id //"> Name : <input type="text" name="emp_name" value="//here i want to assign $result->emp_name //"> Password: <input type="password" name="emp_pass" value=""> Confirm Password: <input type="password" name="con_pass" value=""> User Type: <select name="usertype" > // Here i want to select the option depending upon the value from database, if it is S or O. <option value="0" SELECTED>Select</option> <option value="S">SUPER USER</option> <option value="O">ORDINARY USER</option> </select> <input type="button" Value="ADD" OnClick="check();"> <input type="submit" value="Submit"> </p> </center> </div> </form> </BODY> </HTML> Thanks in advance. Regards -Balaji

The Information contained and transmitted by this E-MAIL is proprietary to Wipro Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If this is a forwarded message, the content of this E-MAIL may not have been sent with the authority of the Company. If you are not the intended recipient, an agent of the intended recipient or a person responsible for delivering the information to the named recipient, you are notified that any use, distribution, transmission, printing, copying or dissemination of this information in any way or in any manner is strictly prohibited. If you have received this communication in error, please delete this mail & notify us immediately at mailadmin@wipro.com.
« previous php.general (#59725) next »