<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td>
<?php
$emailnl = mysql_real_escape_string(stripslashes($_REQUEST['emailnl']));
		   
$name = mysql_real_escape_string(stripslashes($_REQUEST['name']));
$address = mysql_real_escape_string(stripslashes($_REQUEST['address']));
$city = mysql_real_escape_string(stripslashes($_REQUEST['city']));
$tel = mysql_real_escape_string(stripslashes($_REQUEST['tel']));
$email = mysql_real_escape_string(stripslashes($_REQUEST['email']));
$comments = mysql_real_escape_string(stripslashes($_REQUEST['comments']));
		   
			if  (isset($_POST['submit2'])) {
			$emailnl;
			$sql="DELETE FROM nlmembers WHERE email='$email'";
			$result = mysql_query($sql);
?>
                <?php echo $fieldnl1 ?> 
    <?php } else { ?>
 
    <?php require_once 'fprotect.php'; ?>
           
    <?php 
	if  (isset($_POST['submit'])) {
    $name=safe($name); 
	$address=safe($address);
	$city=safe($city);
    $country=safe($country); 
    $tel=safe($tel); 
    $email=safe($email); 
    $comments=safe($comments); 
    $code1=safe($code1); 
	?>
	
   	<?php
if (preg_match("/a href/i", "$comments")) {
?> 
<?php } else { ?>

<?php if ($_REQUEST['data']==$_POST['code1']) { ?>

<?php 
      $memberid;
	  $sql1="UPDATE nlmembers SET name='$name', email='$email', address='$address', city='$city', tel='$tel', comments='$comments' WHERE id='{$_REQUEST['memberid']}'";
	  $result1 = mysql_query($sql1);
?>
                      </td>
                    </tr>
                    <tr> 
                      <td> 
               <?php echo $fieldnl2 ?> 
                     </td>
                    </tr>
                    <tr> 
                      <td>
                       <?php } else { ?>
                      
                      </td>
                    </tr>
                    <tr> 
                      <td>
                      <?php echo $fieldtext2 ?>
                      </td>
                    </tr>
                    <tr> 
                      <td> 
                        <?php } ?>
                        <?php } ?>
                        <?php } else { ?>
                        <?php
			$sql2="SELECT  * FROM nlmembers WHERE email='$emailnl'";
			$result2 = mysql_query($sql2);
			$myrow=mysql_fetch_array($result2);
			$id=$myrow[id];
			$name=$myrow[name];
			$emailold=$myrow[email];
			$address=$myrow[address];
			$city=$myrow[city];
			$tel=$myrow[tel];
			$comments=$myrow[comments];
			
			if  ($emailold == "" AND $emailnl!="") {
				$sql3 = "INSERT INTO nlmembers (email, category_id) VALUES ('$emailnl', '1')";
				$result3 = mysql_query($sql3);
				
				$sql4="SELECT * FROM nlmembers WHERE email='$emailnl'";
				$result4 = mysql_query($sql4);
				$myrow=mysql_fetch_array($result4);
				$id=$myrow[id];
			}
?>
                      </td>
                    </tr>
                    <tr> 
                    
                        <td>
                        <form name="forma" method="post" action="">	
                        <input type="hidden" name="memberid" value="<?php echo $id?>">
                          <table width="100%" border="0" cellpadding="0" cellspacing="2">
                            <tr valign="top"> 
                              <td>
                                <?php echo $fieldname ?>*
                              </td>
                              <td><input name="name" type="text" class="forms" id="name" value="<?php echo $name?>" size="30" maxlength="100"></td>
                            </tr>
                            <tr valign="top"> 
                              <td>
                                <?php echo $fieldaddress ?>   
                              </td>
                              <td><input type="text" name="address" size="30" value="<?php echo $address ?>" class="forms" maxlength="100"></td>
                            </tr>
                            <tr valign="top"> 
                              <td>
                                <?php echo $fieldcity ?>   
                              </td>
                              <td><input type="text" name="city" size="30" value="<?php echo $city ?>" class="forms" maxlength="100"></td>
                            </tr>
                            <tr valign="top"> 
                              <td>
                                <?php echo $fieldtel ?> 
                              </td>
                              <td><input type="text" name="tel" size="30" value="<?php echo $tel ?>" class="forms" maxlength="50"></td>
                            </tr>
                            <tr valign="top">
                              <td>E-mail*</td>
                              <td><input name="email" type="text" class="forms" id="email" value="<?php echo $emailnl ?>" size="30" maxlength="60"></td>
                            </tr>
                            <tr valign="top">
                            <td>
               <?php echo $fieldcomments ?>                            
                            </td>
                              <td><textarea name="comments" id="comments" class="forms" rows="6" cols="23"><?php echo $comments ?></textarea></td>
                            </tr>
                            <tr valign="top">
                              <td>
 <?php echo $fieldcode ?>
 <?
global $data;
$data = mt_rand(100000,1000000);
?>
    <input type="hidden" name="code1" value="<?php echo $code1 ?>">
    <input type="hidden" name="data" value="<?php echo $data ?>">                             

                                  </td>
                              <td>
    <img src="<?php echo $sitepath ?>includes/dynamicimage.php?dt=<? global $data; echo base64_encode($data);?>" alt="">                                
    <input type="text" name="code1" id="code1" size="8" class="forms" maxlength="6"></td>
                            </tr>
                            <tr valign="top">
                              <td>
               * <?php echo $fieldrequired ?>
                              </td>
                              <td>
<input name="submit" type="submit" class="button" onClick="MM_validateForm('name','','R','email','','RisEmail');return document.MM_returnValue" value="<?php echo $button2 ?>">
<input type="submit" name="submit2" value="<?php echo $button3 ?>" class="button">                              
                              </td>
                            </tr>
                          </table>
						  </form>
                        
                        </td>
                    </tr>
                    <tr> 
                      <td> 
              <?php } ?>
              <?php } ?>
                </td>
                    </tr>
                  </table>