Page 1 of 1

Help in php?

Posted: Fri Sep 04, 2009 11:32 pm
by adilmarwat2004
Database Name: prj
Table Name: inf
Table "inf" contains three fields.
1: Roll#
2: Name
3: Domicile

I want to create php form that I can enter the Roll# and in result show the
Roll#, Name and Domicile of the student.

please help me this regard.

adilmarwat2004

Re: Help in php?

Posted: Fri Sep 04, 2009 11:57 pm
by John.Mike
hi,adilmarwat.you can do it like below:
<form action="process.php" method="POST">
<table>
<tr><td>PLS INPUT YOUR Roll#<input type="text" name="roll"></td></tr>
</table>
</form>

process.php:
<?php
$roll=$_POST['roll'];
mysql_connect("mysqlserveraddress","user","passwd");
mysql_select_db('prj');
$selecto=select * from inf where Roll#='$roll';
$result=mysql_query($selecto);
while($rs=mysql_fetch_array($result))
{
echo $rs['Roll#'].'<br/>';
echo $rs['Name'].'<br/>';
echo $rs['Domicile'].'<br/>';
}

?>


Hopes it helps you .

Re: Help in php?

Posted: Sat Sep 05, 2009 12:11 am
by adilmarwat2004
thanks i will do as u advise.

regards