Help in php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

Help in php?

Post 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
John.Mike
Forum Newbie
Posts: 18
Joined: Fri Sep 04, 2009 11:43 pm
Location: Canton.China

Re: Help in php?

Post 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 .
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

Re: Help in php?

Post by adilmarwat2004 »

thanks i will do as u advise.

regards
Post Reply