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
Help in php?
Moderator: General Moderators
Re: Help in php?
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 .
<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 .
-
adilmarwat2004
- Forum Commoner
- Posts: 44
- Joined: Fri Sep 04, 2009 11:28 pm
Re: Help in php?
thanks i will do as u advise.
regards
regards