Forum Moderators: coopster
a normal form without requirement fields
if the user check the checkbox the page will reload and the form fields now will be require
this is what i have but i got error
anyone see what i do wrong
<?php
//this is a bit of javascript too...
?>
<script>
function refreshstuff()
{
document.myform.foo2.value="changed";
document.myform.submit();
}
</script>
<form name="myform">
<input type="checkbox" name="foo2" value="checkbox" onChange="refreshstuff();">
<input size="35" name="Email" VALUE maxlength="60">
<?php
if($foo2 == "changed")
{
//....refresh form with requirements
<form name="myform">
<input type="checkbox" name="foo2" value="checkbox">
<input size="35" name="Email" VALUE maxlength="60">
}
?>
<form name="myform">
<input type="checkbox" name="foo2" value="checkbox">
<input size="35" name="Email" VALUE maxlength="60">
in an if statement is going to cause a problem as you aren`t echoing or printing the data. You need to use:
<?php
if($foo2 == "changed")
{
//....refresh form with requirements
?>
<form name="myform">
<input type="checkbox" name="foo2" value="checkbox">
<input size="35" name="Email" VALUE maxlength="60">
<?php
}
?>
dc
<?php
//...
?>
<form name="myform" method="POST" action="<?php echo $SERVER["PHP_SELF"];?>">
<<input type="checkbox" name="foo2" value="checkbox" onChange="refreshstuff();">
<input size="35" name="Email" VALUE maxlength="60">
<?php
if($_POST["foo2"] == "changed")
{
//....refresh form with requirements
?>
<form name="myform" method="POST" action="<?php echo $SERVER["PHP_SELF"];?>">
<input type="checkbox" name="foo2" value="checkbox">
<input size="35" name="Email" VALUE maxlength="60">
<?php
}
?>
Best regards
Michal Cibor