Page 1 of 1

How to echo a radio button?

Posted: Thu Sep 24, 2009 5:37 pm
by aronjeney
I am a designer and ultimate newbie to php so all help is VERY appreciated. I am slowly teaching myself fundamentals.

I have a client who is accepting donations through paypal and would like to have a radio button appear on the Thank You page IF a user donates more than $30. I have gotten so far as to ECHO a set of text if they donate more than $30, but am having troubles ECHOing a form for a clickable radio button. Can I echo a form or do I incorporate the php into a form?

Here is the code that I am attempting:

Code: Select all

 
 
     <?php       
            if ($_POST['amt'] >= 30) {
            echo '<Form name ="form1" Method ="Post" ACTION ="radioButton.php">
              <Input type = 'Radio' Name ='sendreport' value= 'true'>
              <span>Check this box if you would like to receive email forecasts directly from the Colorado Avalanche Information Center.</span>
              <Input type = "Submit" Name = "Submit1" Value = "Get weather reports">
            </FORM> ';
            } else {
            echo 'Thank you.';
            }
      ?>
 
 

Thank you so much in advance for any help/suggestions!

Re: How to echo a radio button?

Posted: Thu Sep 24, 2009 7:21 pm
by Christopher
The value will be in $_POST['sendreport'].

Re: How to echo a radio button?

Posted: Mon Sep 28, 2009 1:30 pm
by aronjeney
I was able to solve my issue by simply single quoting within the quotes..

Code: Select all

<?php       
            if ($_POST['amt'] >= 29) {
            echo "<Form name ='form1' Method ='Post' ACTION =''>
                    <Input type = 'Radio' Name ='sendreport' value= 'true'>
                    <span>Check this box if you would like to receive email forecasts directly from the Colorado Avalanche Information Center.</span>
                    <Input type = 'Submit' Name = 'Submit1' Value = 'Get weather reports'>
                  </FORM> ";
                  } else {
                  echo 'Thank you.';
                  }
                  ?>
                </div>

Thanks all!