help with html + PHP if statement

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
newwithphp
Forum Newbie
Posts: 2
Joined: Thu Aug 14, 2008 4:47 am

help with html + PHP if statement

Post 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
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: help with html + PHP if statement

Post 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..
 
}
 
 
Post Reply