Page 1 of 1

help with html + PHP if statement

Posted: Tue Aug 19, 2008 4:50 am
by newwithphp
Hi all, I need some help
I am very new with the PHP and HTML, I tried to edit this message so it will be readable

I have this HTML Code:

<html>
<head>
<title>create orders</title>
<script>
function enable()
{
document.myForm.textbox.disabled = false;
}
</script>
</head>

<body>
<div align="left">
<form action="create_orders.php" method="post">
<p dir="ltr" style="MARGIN-RIGHT: 0px" align="left">&nbsp;</p>
<p dir="ltr" style="MARGIN-RIGHT: 0px" align="left">
item:&nbsp; <input name="item" <br><br>
quantity:&nbsp; <input name="quantity"><br>
sapak:&nbsp;&nbsp;&nbsp;&nbsp; <input name="sapak"><br>

<input type="submit" value="Submit Query"> </p>
</form>

<form name="myForm">
<input type="checkbox" onclick="enable()">&nbsp;&nbsp;enable to link for another order<br><br>
<input type="text" name="textbox" value="enter order num" disabled>
</form>
</div>

how can I do an if statement that will check if the checkbox enable or not, if yes I want the value that the user enter will enter to a variable and I will call a function from my DB.


I hope my message is clear enough

Thanks a lot

Re: help with html + PHP if statement

Posted: Mon Aug 25, 2008 6:30 am
by susrisha
first give a name to the check box say name="chkbox"
in the php code write this

Code: Select all

 
$chkbox= $_POST['chkbox'];
if($chkbox==on)
{
//your code goes here..
 
}