"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:oa********************************@4ax.com...
You've got some extra spaces and missing quotes there. A step in the right
direction would be:
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>">
I've cut and paste that and no joy :-(
Define "doesn't work". What does it do? What do you get in the HTML
output?
How does it differ from before?
I'll put all the relevant code at the bottom of this page so you can examine
it. It doesn't work as in the values don't appear to be submitted to itself
as in it won't print the error message if a box isn't ticked, and it won't
forward to the page if it is ticked. It did work before! I'm not really very
conversant with PHP although I managed to put this together myself with a
little forum help etc. All I really need is the two tick boxes, to give an
error message if not ticked, and to take to the appropriate page if ticked.
<?php
$message1 = "";
$message2 = "";
if (isset($Submit) && $Submit == "I consent and wish to participate")
{
if ($_POST[withdraw]!= "Yes")
{
$message1 = "You must tick the box in order to continue";
}
if ($_POST[noanswer]!= "Yes")
{
$message2 = "You must tick the box in order to continue";
}
if ($message1 == "" && $message2 == "")
{
header("Location: http://www.an1.co.uk/survey");
}
}
?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>"
method="post" name="form1" class="style4">
<p align="left">
<input name="withdraw" type="checkbox" id="withdraw6"
value="Yes">
I understand that I may withdraw
from this investigation at any stage <br>
<span class="style3">
<?php
if ($message1!= "")
{
print "$message1";
}
?>
</span> </p>
<p align="left">
<input name="noanswer" type="checkbox" id="noanswer6"
value="Yes">
I understand that I am free to choose not to
answer a question without giving a reason why
<br>
<span class="style3">
<?php
if ($message2!= "")
{
print "$message2";
}
?>
</span> </p>
<p align="left">
<input type="submit" name="Submit" value="I consent and wish
to participate">
</p>
</form>