boblan66 Posted November 24, 2010 Share Posted November 24, 2010 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. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 24, 2010 Share Posted November 24, 2010 What is the error? Paste it in here, and I suspect you'll need to paste more of the preceding code in as well. Quote Link to comment Share on other sites More sharing options...
boblan66 Posted November 24, 2010 Author Share Posted November 24, 2010 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> Quote Link to comment Share on other sites More sharing options...
noXstyle Posted November 25, 2010 Share Posted November 25, 2010 // If alumni is equal to 3 display the input field Line 127--->If ($ans == 3);{ No semicolon after condition. Edit: Oh yeah, and the following echo statement must be closed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.