Jump to content

if statement problem


boblan66

Recommended Posts

I am creating a class alumni web and ask a question tha requires selecting one of 3 radio buttons. If the user selects the 3rd button, I want to display an additional field.

 

Here is the lines of code:

<label>Are you or your spouse a Taft Class of 1965 alumni?</label>
	<input type="radio" id="alumni" value=1 checked><label>yes</label>
	<input type="radio" id="alumni" value=2><label>no</label>
	<br>
	<label>Are you a graduate of Taft Union High School?</label>
	<input type="radio" id="alumni" value=3><label>yes</label>
      Error  ---> <?php
		// If alumni is equal to 3 display the input field
		  If ($ans == 3);{
		    Echo "<input type='int' id='gradClass' size='4' maxlenght='4' placeholder='1977'>"
		  }
		?>
    <br>
	<hr>
	<br>
	<span class="subheader">PRIVACY</span>
	<br>

 

And I didn't forget a ' this time.

 

Could someone please assist. Thanks in advance.

Link to comment
Share on other sites

Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/taft65/public_html/registerform.php on line 123

 

I noticed that I placed the eoor arrow pointing at the incorrect line. Line 123 is the beginning of the if statement.

 

Here is some more of the code:

 

<label>Email Address: </label><input type="varchar" id=email" size="12" maxlenght="50" required>
	<label>Confirm Email: </label><input type="varchar" id="email2" size="12" maxlenght="50">
	<br>
	<br>
	<label>Phone: </label><input type="varchar" id="phone" size="10" maxlenght="40">
	<label>Cell Phone: </label><input type="varchar" id="phone" size="10" maxlenght="40">
	<br>
	<br>
	<label>Are you or your spouse a Taft Class of 1965 alumni?</label>
	<input type="radio" id="alumni" value=1 checked><label>yes</label>
	<input type="radio" id="alumni" value=2><label>no</label>
	<br>
	<label>Are you a graduate of Taft Union High School?</label>
	<input type="radio" id="alumni" value=3><label>yes</label>
	    <?php
		// If alumni is equal to 3 display the input field
    Line 127--->If ($ans == 3);{
		    Echo "<input type='int' id='gradClass' size='4' maxlenght='4' placeholder='1977'>"
		  }
		?>
    <br>
	<hr>
	<br>
	<span class="subheader">PRIVACY</span>
	<br>
	<input type="radio" id="privacy" value="1" checked><label>You may share information with Reunion Committee only.
    	<input type="radio" id="privacy" value="2"><label>You may share information with Alumni.
        <br>
	<center><a href="privacy.shtml" id="whiteLink">Privacy statement</a></center>
	<hr>
	<br>
	<span class="subheader">NEWSLETTER SURVEY</span>
	<br>
	<label>Would you want to receive an alumni newsletter, when and if it becomes available?</label>
	<br>
	<input type="radio" id="newsletter" value="1" checked><label>Yes</label>
    	<input type="radio" id="newsletter" value="2"><label>No</label>
	<input type="radio" id="newsletter" value="3"><label>Undecided</label>
    	<br>
        <br>
    	<input type'hidden" id="memDate" value="<?php gmdate("l dS \of M Y H:i:s a")?>">
	<input type'hidden" id="ip" value="<?php $ip=$_SERVER['REMOTE_ADDR'];?>">
	<br>
	<hr>
	<br>
	<center>
      	<input class="button" type="submit" value="Register">
      	<input class="button" type="reset" value="Clear">
         </center>
    </form>      

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.