PDA

View Full Version : forms in php !


Nourah
04-04-2003, 09:16 AM
Hi ,,

I have simple form , with submit button , when the user click on submit , another form is displayed in the same page.

this second form when the user click on its submit button , this button don't work , it's work as the first form submit button , although that the action called a nother page ..

help me plzzzzzzzzzzzzzzzzzzz

magicwand
04-04-2003, 05:39 PM
post your code

Immulsifier
04-04-2003, 08:29 PM
hehehe :)

Nourah
04-05-2003, 05:06 PM
Thanx magicwand ,,
here's the code :
------------------------
<html>
<head>

<?
function drawtable1()
{
?>
<form name="form2" methode = "post" action="dalal_.php">

<table width="90%" border="1">
<tr>
<td width="92" rowspan="2"><div align="center"><strong><font size="4"> no
of classes </font></strong></div></td>
<td colspan="4"><div align="center"><strong><font size="4">Ranges</font></strong></div></td>
<td width="105"><div align="center"><strong><font size="4">System</font></strong></div></td>
<td width="106"><div align="center"><strong><font size="4">classes</font></strong></div></td>
</tr>
<tr>
<td width="50" height="26"><div align="center"><strong>D</strong></div></td>
<td width="47"><div align="center"><strong>C</strong></div></td>
<td width="42"><div align="center"><strong>B</strong></div></td>
<td width="43"><div align="center"><strong>A</strong></div></td>
<td width="105"></td>
<td width="106"></td>
</tr>

<tr>
<td><div align="center">
<input name="number_of_class" type="text" id="number_of_class" size="2" maxlength="2">
</div></td>
<td width="50"><div align="center">
<input name="D" type="text" id="D" size="2" maxlength="2">
</div></td>
<td width="47"><div align="center">
<input name="C" type="text" id="C" size="2" maxlength="2">
</div></td>
<td width="42" align="center" valign="middle"><div align="center">
<input name="B" type="text" id="B" size="2" maxlength="2">
</div></td>
<td width="43" align="center" valign="middle"> <div align="center">
<input name="A" type="text" id="A" size="2" maxlength="2">
</div></td>
<td width="105" rowspan="1" align="center" valign="middle"><div align="center"><strong>
<select name="sys" id="sys">
<option>other</option>
<option>grades</option>
</select>
</strong></div></td>
<td width="106" rowspan="1" align="center" valign="middle"><div align="center"><strong>
1st </strong></div></td>
</tr>
</table>

<input type="submit" value="enter" align="center"/>
<input type="reset" value="reset" align="center "/>

</form>

<?
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////// end of table1

?>
</head>
<body>


<br><br>
<p><h2 style = "font-famiy : arial ; color:blue">
select: </h2></p>

<form name="form1" methode = "post" action="forum.php">


<p><h4>category
<select name= category>
<option value="class">class</option>
<option value="subject">subject</option>
</select>
</h4></p>

<p><h4>level :
<select name = level>
<option>1st</option>
<option>2nd</option>
</select>

<?php
$db=mysql_connect("localhost","","");

if ( ! $db )
{
echo "error , can't open the database . " ;
exit ;
}

mysql_select_db("school",$db);
$query = "select * from level";

$result = mysql_query ($query,$db);

$num_results = mysql_num_rows ($result);

for ( $i = 0 ; $i < $num_results ; $i ++)
{
$row = mysql_fetch_array($result);

$option_key = $row["name"] ;
$option_val = $row["name"] ;

print "<option value = '$option_key'> $option_val </option> \n" ;


} //end of for loop


echo "</select>" ;


echo'<input name="go" type="submit" id="go" value="Go">';

if( (strcmp($category,'class')==0)&&(strcmp($level,'1st')==0))
drawtable1();

?>

</form>

</body>
</html>
-------------------------------

Waiting ur replay