Exam Result Php code

Codes here !

Moderators: macek, egami, gesf

deepanc104
New php-forum User
New php-forum User
Posts: 3
Joined: Wed May 07, 2014 8:50 pm

Exam Result Php code

Postby deepanc104 » Wed May 07, 2014 9:11 pm

Hi... I am trying to get php result based on text box value from mysql database. I tried with the following code. But I am struggle in display result. When user enter valid number it show result with table else it show the label enter correct code./style></head>

<body>

<div class="container">
<div class="header"><a href="#"></a>
<!-- end .header -->WELCOME</div>
<div class="content">
<h1>&nbsp;</h1>
<p>&nbsp;</p>
<?php
mysql_connect("localhost", "root", "root") or die("Connection Failed");
mysql_select_db("marks")or die("Connection Failed");
$name = $_POST['regno'];
$query = "select * from six where No = '$name'";
$result = mysql_query($query);

?>
<form name="form1" method="post" action="">
<p>
<label for="regno"> Register Number</label>
<input type="text" name="regno" id="regno">
</p>
<p>&nbsp;</p>
<p>
<input type="submit" name="Get result" id="Get result" value="Submit">
</p>
</form>
<p>&nbsp;</p>
<table width="471" border="1" align="center">
<tr>
<th height="43" colspan="2" scope="col">Register Number :</th>
</tr>
<tr>
<th height="45" colspan="2" scope="col"> Name : </th>
</tr>
<tr>
<th width="140" scope="col">Subject 1</th>
<td width="315">&nbsp;</td>
</tr>
<tr>
<td>Subject 2</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Subject 3</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Subject 4</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Subject 5</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Total</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Result</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<!-- end .content --></div>
<div class="footer">
<p>Powered By @ 2014</p>
<!-- end .footer --></div>
<!-- end .container --></div>
</body>

Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest

cron