TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
shah varshil
NA
5
3.6k
data not display in textbox
Feb 14 2014 9:51 PM
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="ques"; // Table name
$con = mysql_connect("$host","$username")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$quesid=$_POST['quesID'];
$question =$_POST['questions'];
if ($quesid <> "")
{
$sql = "SELECT * FROM $tbl_name WHERE quesID = '$quesid'";
while($result= mysql_fetch_assoc($sql))
{
$quesi = $result['quesID'];
$ques = $result['ques'];
$op1 = $result['op1'];
$op2 = $result['op2'];
$op3 = $result['op3'];
$op4 = $result['op4'];
$exans = $result['exans'];
}
}
else
{
$sql = "SELECT * FROM $tbl_name WHERE questions='$question'";
while($result= mysql_fetch_assoc($sql))
{
$quesi = $result['quesID'];
$ques = $result['ques'];
$op1 = $result['op1'];
$op2 = $result['op2'];
$op3 = $result['op3'];
$op4 = $result['op4'];
$exans = $result['exans'];
}
}
?>
<p> </p>
<form id="comForm" name="comForm" method="post" action="updateque.php">
<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td ><b>Question ID :</b></td>
<td ><input name="quesid" value=<?php echo "$quesi" ?>" /> </td>
</tr>
<tr>
<td ><b>Question :</b></td>
<td ><input name="ques" value="<?php echo "$ques" ?>" /> </td>
</tr>
<tr>
<td ><b>Option 1 :</b></td>
<td ><input name="op1" value="<?php echo "$op1" ?>" /> </td>
</tr>
<tr>
<td ><b>Option 2 :</b></td>
<td ><input name="op2" value="<?php echo "$op2" ?>" /> </td>
</tr>
<tr>
<td ><b>Option 3 :</b></td>
<td ><input name="op3" value="<?php echo "$op3" ?>" /> </td>
</tr>
<tr>
<td ><b>Option 4 :</b></td>
<td ><input name="op4" value="<?php echo "$op4" ?>" /> </td>
</tr>
<tr>
<td ><b>Right Answer :</b></td>
<td ><input name="exans" value="<?php echo "$exans" ?>" /> </td>
</tr>
</table>
</form>
Reply
Answers (
3
)
i try to display data from database in textbox...
how to show data