Well, thought of starting a new thread....
but nah...here it goes again, or stil 😉
Here is myy not working as I want to code:
<html>
<head>
<title>Radio's</title>
<body>
<?php
$text1='hello';
$text2="you";
if(!isset($_POST['submit']) ||
($_POST['radio']==1 && $_POST['text1']!=$text1) ||
($_POST['radio']==2 && $_POST['text2']!=$text2) ){
echo '<form action="',$_SERVER['PHP_SELF'],'" method="post">';
//two ways of submitting the form:
echo"check 1fst radio & type hello in 1fst textbox or"."<br>\n";
echo"check 2nd radio & type you in 2nd textbox"."<br>\n";
echo"if not, this form should be shown"."<br>\n";
?>
<input type="radio" name="radio" value="
<?php
if (isset($_POST['radio'])){
$_POST['radio']=1;
}else{
$_POST['radio']=0;
}
echo $_POST['radio'];
?>">
<input type="radio" name="radio" value="
<?php
if (isset($_POST['radio'])){
$_POST['radio']=2;
}else{
$_POST['radio']=0;
}
echo $_POST['radio'];
?>">
<input type="text" name="text1" value="<?php echo $_POST['text1']?>">
<input type="text" name="text2" value="<?php echo $_POST['text2']?>">
<input type="submit" name="submit" value="send">
</form>
</body>
</head>
</html>
<?php
}else{
echo "looks good , process data"."<br>\n";
}
?>
The condition
if(!isset($_POST['submit']) ||
($_POST['radio']==1 && $_POST['text1']!=$text1) ||
($_POST['radio']==2 && $_POST['text2']!=$text2) ){
I can't seem to get working
Process this form if first radio is checked and first textbox is "hello" or
Process this form if second radio is checked and second textbox is "you"
I hope this explains my struggle much better.
Hope to get some sort of help with my coding or thinking; NewB.
Thanks
Zackat