title: Parse error: syntax error, unexpected '{' in C:\wamp\www\reg.php
body: <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;
  Registration
  &lt;/title&gt;
  &lt;/head&gt;
  &lt;?php
  if(isset($_POST['submit buttton'])){
      processForm();
  }else{
      displayForm();
  }
  
  
  /*check out this function. Here in array doesnot work*/
  
  function validateField($fieldname,$missingfield){
      if(in_array($fieldname,$missingfield)){
          echo 'class = "error"';
      }
  }
  function setValue($fieldname){
      if(isset($_POST[$fieldname])){
          echo $_POST[$fieldname];
      }
  }
  
  function setChecked($fieldname,$fieldvalue){
      if((isset($_POST[$fieldname]) and ($_POST[fieldname] == $fieldvalue)){
          echo 'checked = "checked"';
      }
  }
  function setSelected( $fieldName, $fieldValue ) {
      if ( isset( $_POST[$fieldName] ) and $_POST[$fieldName] == $fieldValue ) {
          echo ' selected="selected"';
      }
  }
  function processForm(){
      $requiredfields = ("firstname","lastname","password1","password2","gender");
      $missingfields = array();
      foreach($missingfields as $missingfield){
          if((!isset($_POST[$requiredfield]) or $_POST[$requiredfield]){
              $missingfields[] = $requiredfield ;
          }
      }
      if ( $missingFields ) {
          displayForm( $missingfields );
      } else {
      displayThanks();
      }
  }
  
  function displayForm($missingfields){
      &lt;?php
          &lt;h1&gt;Membership Form&lt;/h1&gt;
          &lt;?php if ( $missingFields ) { ?&gt;
          &lt;p class="error"&gt;There were some problems with the form you submitted.
          Please complete the fields highlighted below and  click Send Details to
          resend the form.&lt;/p&gt;
          &lt;?php } else { ?&gt;
          &lt;p&gt;Thanks for choosing to join The Widget Club. To register, please
          fill in your details below and click Send Details. Fields marked with an
          asterisk (*) are required.&lt;/p&gt;
      ?&gt;
  
  &lt;?php } ?&gt;
  
      &lt;form action="registration.php" method="post"&gt;
      &lt;div style="width: 30em;"&gt;
      &lt;label for="firstName"&lt;?php validateField( "firstName",
                          $missingFields ) ?&gt;&gt;First name *&lt;/label&gt;
      &lt;input type="text"  name="firstName" id="firstName"
                          value="&lt;?php setValue( "firstName" ) ?&gt;" /&gt;
      &lt;label for="lastName"&lt;?php validateField( "lastName",
  $missingFields ) ?&gt;&gt;Last name *&lt;/label&gt;
      &lt;input type="text" name="lastName" id="lastName" value=
      "&lt;?php setValue( "lastName" ) ?&gt;" /&gt;
      &lt;label for="password1"&lt;?php if ( $missingFields ) echo
      ' class="error"’ ?&gt;&gt;Choose a password *&lt;/label&gt;
      &lt;input type="password" name="password1" id="password1" value="" /&gt;
      &lt;label for="password2"&lt;?php if ( $missingFields ) echo
      ' class="error"’ ?&gt;&gt;Retype password *&lt;/label&gt;
      &lt;input type="password" name="password2" id="password2" value="" /&gt;
      &lt;label&lt;?php validateField( "gender", $missingFields ) ?&gt;&gt;Your
      gender: *&lt;/label&gt;
      &lt;label for="genderMale"&gt;Male&lt;/label&gt;
      &lt;input type="radio" name="gender" id="genderMale" value=
      "M"&lt;?php setChecked( "gender", "M" )?&gt;/&gt;
      &lt;label for="genderFemale"&gt;Female&lt;/label&gt;
      &lt;input type="radio" name="gender" id="genderFemale" value=
      "F"&lt;?php setChecked( "gender", "F" )?&gt; /&gt;
      &lt;label for="favoriteWidget"&gt;What’s your favorite widget? *&lt;/label&gt;
      &lt;select name="favoriteWidget" id="favoriteWidget" size="1"&gt;
      &lt;option value="superWidget"&lt;?php setSelected( "favoriteWidget",
      "superWidget" ) ?&gt;&gt;The SuperWidget&lt;/option&gt;
      ?&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>On my first run of the file the in_array function doesnt seem to work.I mean functions like isset() are displayed in bold but it seems the in_array function is not detected.
  The browser displays the error as:</p>
  
  <blockquote>
    <p>( ! ) Parse error: syntax error, unexpected '{' in C:\wamp\www\reg.php
    on line 15.</p>
  </blockquote>