Page 1 of 1

Cannot add header information but using flush

Posted: Sun Oct 12, 2003 6:03 am
by jamrop
Hey

wonder if anyone can help. I have a register page but when someone submits the page i get the error

Warning: Cannot add header information - headers already sent by (output started at /usr/local/psa/home/vhosts/test.co.uk/httpdocs/reg/register.php:1) in /usr/local/psa/home/vhosts/test.co.uk/httpdocs/reg/register.php on line 710


i am using ob_flush but still getting the error. can anyone help?

code below

Code: Select all

<?php
 <?php 
ob_start(); 
// get database info
		require('../dbinfo.php');	
//get the required count info
		require('../allcat.php');
//if the form has been submitted
if (isset($_POST['submit'])) {
$valid=true;
//check to see if the following fields has been filled out
if (!$_POST['username'] | !$_POST['password'] | !$_POST['confirm'] |  !$_POST['contact']  | 
!$_POST['location'] |!$_POST['postcode']  |  !$_POST['email']  | !$_POST['area']    | !$_POST['homtel']   )
{$errmsg.="You have not filled in a required field<br>"; $valid=false;}
//check to see if the username has already been taken
$sql = "select username from members where username = '$username'";
$rs=mysql_query($sql,$db);
$numofrows =mysql_num_rows($rs);
	if($numofrows !=0) {
		$errmsg.=" Sorry, the username: <strong> $username </strong> 
					is already taken, please pick another one<br>"; $valid=false;}
							
//make sure that the password field and the confirm password field match up
if  ($_POST['password'] != $_POST['confirm']){
	$errmsg.="Passwords did not match, Please try again<br>"; $valid=false;}
//also check that the password is 5 or more words
if (strlen($_POST['password']) <= 5) 
	{$errmsg.="You password must be 6 letters or longer<br>"; $valid=false;}	
//check to see if the phone area code is a number
if (!is_numeric($_POST['area']))
	{$errmsg.="Your area code must contain numbers"; $valid=False;}
//check to see if the hoe telephone is a number
if (!is_numeric($_POST['homtel']))
	{$errmsg.="Your Home Telephone number must contain numbers"; $valid=False;}	
//if someone adds there mobile then check to see if it is a number
if ($_POST['mobtel']){
	if (!is_numeric($_POST['mobtel']))
		{$errmsg.="Your Mobile Telephone number must contain numbers"; $valid=False;}}
//check that the email submitted is a genuine email
$_POST['email'] = trim($email);

$_name = "/^[-!#$%&''*+\\.\/0-9=?A-Z^_'{|}~]+";

$_host = "([-0-9A-Z]+\.)+";

$_tlds = "([0-9A-Z]){2,4}$/i";

if (!preg_match($_name."@".$_host .$_tlds,$email) )
	{$errmsg.="Invalid email address, Please try again<br>";
				$valid= false;}
						
$checkemail = "select email from members where email = '$email'";
$em=mysql_query($checkemail,$db);
	$numofrowsem =mysql_num_rows($em);
		if($numofrowsem !=0) {
			$errmsg.="Sorry, the email: <strong> $email </strong> 
						is already taken, please pick another one<br>"; $valid=false;}}
?>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Register</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
      var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   }


function PopUp(url) { window.open(url,"MyPopup",'height=300,width=300, scrollbars=yes'); } 
//-->
</script>
<link href="../style.css" rel="stylesheet" type="text/css">

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../classfied/home_f2.gif','../classfied/login_f2.gif','../classfied/reg_f2.gif','../classfied/help_f2.gif','../classfied/contact_f2.gif','../classfied/subhomebut_r1_c2_f2.gif','../classfied/subgardenbut_r1_c2_f2.gif','../classfied/subfamilybut_r1_c2_f2.gif','../classfied/subvehbut_r1_c2_f2.gif','../classfied/substudentbut_r1_c2_f2.gif')">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
      <td height="90" valign="top"><img src="../classfied/title.gif" width="300" height="80"></td>
  <td align="right" valign="bottom">&nbsp; </td>
  </tr>
  <tr bordercolor="#000000"> 
    <td width="45%" height="19" align="right" bgcolor="#000099"><font color="#FFFFFF" size="-1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Bringing 
	      People Together</strong></font></td>
<td width="55%" align="left" valign="middle" bgcolor="#000099">&nbsp; </td>
  </tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">

  <tr  bgcolor="#99CCFF"> 

    <td width="16%" height="29" align="center" valign="middle"><a href="../index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','../classfied/home_f2.gif',1)"><img src="../classfied/home.gif" name="home" width="105" height="25" border="0"></a></td>

    <td width="16%" align="center"><a href="../login/login.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('login','','../classfied/login_f2.gif',1)"><img src="../classfied/login.gif" name="login" width="105" height="25" border="0"></a></td>

    <td width="16%" align="center"><a href="register.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('reg','','../classfied/reg_f2.gif',1)"><img src="../classfied/reg.gif" name="reg" width="105" height="25" border="0"></a></td>

    <td width="16%" align="center"><a href="javascript:PopUp('../help/help.htm')" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('help','','../classfied/help_f2.gif',1)"><img src="../classfied/help.gif" name="help" width="105" height="25" border="0"></a></td>

    <td width="16%" align="center"><a href="../contact/contact.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('contact','','../classfied/contact_f2.gif',1)"><img src="../classfied/contact.gif" name="contact" width="105" height="25" border="0"></a></td>

  </tr>

</table>



<table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr bgcolor="#000099"> 

<td width="50%" height="29" align="right" valign="middle"></td>

<td width="50%" valign="top"></td>

</tr>

</table>



<table width="100%" height="418" border="0">

<tr> 

<td width="1%">

<td width="98%" valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="1" bordercolor="#666666">

 <tr> 

<td width="17%" height="282" align="center" valign="top" bgcolor="#FFFFFF"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif"><strong>Category 

</strong> </font> 
			<?php include_once('../includes/cat2.php'); ?>
<font size="-1" >
<?php include_once('../includes/info2.php'); ?>
<br>
<?php include_once('../includes/jobs3.php') ; ?>
<strong>Search</strong></font> 
<table width="100%" border="1" cellpadding="1" cellspacing="1" bordercolor="#33CC99">

              <form name="find" action="../adverts/searchall.php" method="post">

                <tr> 

                  <td align="center" bgcolor="#99FFCC"> <input type="text" size="20" name="find"> 

                  </td>

                </tr>

                <tr>

                  <td align="center" bgcolor="#99FFCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                      <tr>

                        <td width="36%" height="17">

<input type="radio" name="searchtip" value="advert" checked></td>

                        <td width="64%">Category</td>

                      </tr>

                      <tr>

                        <td><input type="radio" name="searchtip" value="event"></td>

                        <td>Notice Board</td>

                      </tr>

                      <tr>

                        <td><input type="radio" name="searchtip" value="job"></td>

                        <td>Jobs</td>

                      </tr>

                    </table></td>

                </tr>

                <tr> 

                  <td align="center" bgcolor="#99FFCC"><input name="submit" type="submit" value="Submit" size="20"></td>

                </tr>

              </form>

            </table> 
          <td width="4%" valign="top"></td>
          <td width="79%" valign="top"><font size="-1" face="Arial, Helvetica, sans-serif"><strong>Register<br><br>

		  </strong></font></p>

            <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Registration 

              at  is easy to do and absolutely free</font></p>

            <p><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">Please 

              enter your details below<br><br><br><font color="#FF0000"><b><?php if ($valid!=true)

					{echo ( $errmsg.$form);} else {
					$_POST['username']= stripslashes($username);
					//add the form information in the database
					$insert= "insert into members (username,password,member_type,contact,location,email,postcode,area,home_tel,mobile_tel,

					datejoined,lastlog,valid) values ('$username', '$password','personal','$contact', '$location', '$email' ,'$postcode', '$area','$homtel', 

					'$mobtel', now(), 'never' ,0)";

					

					mysql_query($insert,$db) or die("Cannot query the database.<br>" . mysql_error());

					//send an email to the user, with the validation information

					$id="select member_id, username from members where username = '$username'";

					$rs=mysql_query($id,$db);

					while ($r = mysql_fetch_array($rs))

								{

									

									$member_id = $r["member_id"]; 

									}

					

					$headers = "MIME-Version: 1.0\n"; 

$headers .= "Content-type: text/html; charset=iso-8859-1\n"; 

$headers .= "From: info@test.co.uk <info@test.co.uk>\n";

$subject = "Member Details";

$body ="<html><head></head><body>Thank you $username for joining AdHudd.  

Your username is $username and your password is $password. 

Please keep these details safe

<br><br><br>To validate you account please 

<a href='http://www.test.co.uk/reg/validate.php?member_id=$member_id'>

click here</a></body></html>";



mail($email, $subject,$body,$headers);
//close the database
mysql_close($db);
					//go to this page
					header("location: complete.php");
					} ?>

					

					</b>

              </font></p>

            <table width="100%" border="0" cellspacing="1" cellpadding="0">

              <tr>

                <td width="20%">Username:</td>

                <td width="63%"><form name="register" action="<?php $PHP_SELF ?>" method="post">

                    <input type="text" name="username" value="<?php echo $_POST['username'] ?>"size="20" maxlength="20">

                 </td>

              </tr>

              <tr>

                <td>Password:</td>

                <td><input type="password" name="password" maxlength="20"><span class="small"><font color="#FF0000">(Your password

				needs to be 6 letters or more)</font></span></td>

              </tr>

              <tr>

                <td>Confirm Password:</td>

                <td><input type="password" name="confirm"></td>

              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>


              </tr>

			  <tr>

                <td>Contact Name:</td>

                <td><input type="text" name="contact" value="<?php echo $_POST['contact'] ?>"  size="20" maxlength="20"><span class="small"><font color="#FF0000">(When people contact you, this is what they will use)</font></span></td>

              </tr>

			  <tr>

                <td>Location:</td>

                <td><input type="text" name="location" value="<?php echo $_POST['location'] ?>" maxlength="20"><span class="small"><font color="#FF0000">(This can be your village or town)</font></span></td>

              </tr>

              <tr>

                <td>Address Postcode</td>

                <td><input type="text" name="postcode" value="<?php echo $_POST['postcode'] ?>" size="10" maxlength="10"><span class="small"><font color="#FF0000">(This 

                  will <b>not</b> be displayed 

                  with your adverts, this is for security reasons only)</font></span></td>

              </tr>

              <tr>

                <td></td>

                <td>&nbsp;</td>

              </tr>

			  <tr>

                <td>Email: </td>

                <td><input type="text" name="email" value="<?php echo $_POST['email'] ?>" size="30" maxlength="40"><span class="small"><font color="#FF0000">

				(You will need a valid email to activate your account)</font></span></td>

              </tr>
			<td>Area phone code: </td>

                <td><input type="text" name="area" value="<?php echo $_POST['area'] ?>" size="10" maxlength="6"><span class="small"><font color="#FF0000">

				</font></span></td>

              </tr>
              <tr>

                <td>Home Telephone :</td>

                <td><input type="text" name="homtel" value="<?php echo $_POST['homtel'] ?>"><span class="small"><font color="#FF0000">

				(You can choose whether you want your number displayed on your advert when adding an advert)</td>

              </tr>

              <tr>

                

          <td>Mobile Telephone :</td>

                <td><input type="text" name="mobtel" value="<?php echo $_POST['mobtel'] ?>"><font color="#FF0000"><span class="small">(Optional)</span></font></td>

              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>

                    <input type="submit" name="submit" value="Submit">

                  </form><br>
 </td>
             </tr>
            </table>
           </td>
       </tr>
      </table></tr>
</table>
</body>
</html>

<?php  

ob_end_flush()



?>


?>
Many thanks

Posted: Sun Oct 12, 2003 6:12 am
by Gen-ik
You can't add Headers to a page anywhere after the <html>. All your headers need to appear before the <head> ( and <doc> I think ) tag in your HTML page...... regardless of if you use buffering or not.


This won't work......

Code: Select all

<?
ob_start();
?>

<html>
<body>

<?
header("Location:somewhere.php");
?>

Some text

</body>
</html>

<?
ob_end_flush()
?>

...... this one will .......

Code: Select all

<?
ob_start();
header("Location:somewhere.php");
?>

<html>
<body>

Some text

</body>
</html>

<?
ob_end_flush()
?>

Posted: Sun Oct 12, 2003 6:25 am
by jamrop
hey

it working tho, till i changed a field name

but if i change the field back it still does the error.

It was working fine b4

Posted: Sun Oct 12, 2003 7:21 am
by jamrop
i have another form that is nearly the same and that works

code below

Code: Select all

<?php
<?php
ob_start();
//start the session

session_start();

header("Cache-control: private"); //IE 6 Fix 

 



//check to make sure the session variable is registered

if(session_is_registered('username')){



//the session variable is registered, the user is allowed to see anything that follows







}

else{



//the session variable isn't registered, send them back to the login page

header( "Location: ../login/login.php" );

}

require('../../dbinfo.php');



require('../../allcat.php');



$check="select * from members where username = '$username'";

$rs=mysql_query($check,$db) or die("Cannot query the database.<br>" . mysql_error());

while ($r=mysql_fetch_array($rs)) {



			$member_id=$r['member_id'];

			$member_type=$r['member_type'];

			}

			
//if the user is the boss then display the page
			if ($member_type == "boss") {

//if the form has been sumitted
if (isset($_POST['submit'])) {
			
			$valid=true;
				//checking to see if the following fields have been filled in
				if (!$_POST['member'] | !$_POST['password'] | !$_POST['confirm'] |  !$_POST['contact']  | 

				!$_POST['business_name'] |!$_POST['business_add1'] 
				
			 |!$_POST['business_town']
				
				|!$_POST['postcode']   | !$_POST['area'] | !$_POST['home_tel']   )
					//if the fields have not been entered, then the error message is show 
					{$errmsg.="You have not filled in a required field<br>"; $valid=false;}

					

					
					//check to see if the username that has been entered is not already in the database
					$sql = "select username from members where username = '$member'";

					$rs=mysql_query($sql,$db);

					$numofrows =mysql_num_rows($rs);

					 	if($numofrows !=0) {
							//if the username is already taken then display this message
							$errmsg.=" Sorry, the username: <strong> $member </strong> 

							is already taken, please pick another one<br>"; $valid=false;}
							
							
							
							
							
							
								//check to see if password and confirmed password match up
								if  ($_POST['password'] != $_POST['confirm']){

									$errmsg.="Passwords did not match, Please try again<br>"; $valid=false;}

							

							if (strlen($_POST['password']) <= 5) 

					{$errmsg.="You password must be 6 letters or longer<br>"; $valid=false;}	


							if (!is_numeric($_POST['area']))

							{$errmsg.="Your area code number must contain numbers"; $valid=False;}
								
							$num = $_POST['home_tel'];
							
							if (!is_numeric($num))

							{$errmsg.="Your Home Telephone number must contain numbers"; $valid=False;}	

									

							if ($_POST['mobtel']){

							if (!is_numeric($_POST['mobtel']))

							{$errmsg.="Your Mobile Telephone number must contain numbers"; $valid=False;}}

							
						//check that ir is an valid email
						if ($_POST['email']) {
									$_POST['email'] = trim($email);

						$_name = "/^[-!#$%&''*+\\.\/0-9=?A-Z^_'{|}~]+";

						$_host = "([-0-9A-Z]+\.)+";

						$_tlds = "([0-9A-Z]){2,4}$/i";

						if (!preg_match($_name."@".$_host .$_tlds,$email) )

						{$errmsg.="Invalid email address, Please try again<br>";

						$valid= false;}
						
						
						$checkemail = "select email from members where email = '$email'";

					$em=mysql_query($checkemail,$db);

					$numofrowsem =mysql_num_rows($em);

					 	if($numofrowsem !=0) {

							$errmsg.="Sorry, the email: <strong> $email </strong> 

							is already taken, please pick another one<br>"; $valid=false;}}


							

					}

					

					

					?>










<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Admin</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_preloadImages() { //v3.0



	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();



	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)



	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}



}



function MM_swapImgRestore() { //v3.0



	 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;



}





function MM_findObj(n, d) { //v4.01



	 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {



	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}



	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];



	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);



	if(!x && d.getElementById) x=d.getElementById(n); return x;



}



function MM_swapImage() { //v3.0



	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)



	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}



}



function PopUp(url) { window.open(url,"MyPopup",'height=300,width=300, scrollbars=yes'); } 







//-->

</script>



<link href="../../style.css" rel="stylesheet" type="text/css">

</head>



<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../../classfied/bossmsg_f2.gif','../../classfied/bosslogout_f2.gif','../../classfied/bossapprovead_f2.gif','../../classfied/bossevent_f2.gif','../../classfied/bossraffle_f2.gif','../../classfied/bosssuspend_f2.gif','../../classfied/bosssaddnew_f2.gif','../../classfied/bossseditnew_f2.gif','../../classfied/bossaddjob_f2.gif','../../classfied/bossaddbus_f2.gif')">
<table width="100%" border="0" cellpadding="0" cellspacing="0">

	<tr> 

		<td height="90" valign="top"><img src="../../classfied/title.gif" width="300" height="80"></td>

		<td align="right" valign="bottom"><?php echo $username ?>&nbsp; </td>

	</tr>



	<tr bordercolor="#000000"> 

		<td width="45%" height="19" align="right" bgcolor="#000099"><font color="#FFFFFF" size="-1"><strong>Bringing People Together</strong></font></td>

		<td width="55%" align="left" valign="middle" bgcolor="#000099">&nbsp; </td>

	</tr>

</table>





<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">



  <tr  bgcolor="#99CCFF"> 



    <td width="16%" height="29" align="center" valign="middle" bgcolor="#00CC99"><a href="../boss.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('main','','../../classfied/bossmain_f2.gif',1)"><img src="../../classfied/bossmain.gif" name="main" width="105" height="25" border="0"></a></td>
<td width="16%" align="center" bgcolor="#00CC99"><a href="../approval/approve.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('aprrove ad','','../../classfied/bossapprovead_f2.gif',1)"><img src="../../classfied/bossapprovead.gif" name="aprrove ad" width="105" height="25" border="0"></a></td>
<td width="16%" align="center" bgcolor="#00CC99"><a href="../approval/event/approve_event.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('approve event','','../../classfied/bossevent_f2.gif',1)"><img src="../../classfied/bossevent.gif" name="approve event" width="105" height="25" border="0"></a></td>
<td width="16%" align="center" bgcolor="#00CC99"><a href="add/add_member.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('addmember','','../../classfied/bossadd_f2.gif',1)"><img src="../../classfied/bossadd.gif" name="addmember" width="105" height="25" border="0"></a></td>
<td width="16%" align="center" bgcolor="#00CC99"><a href="../time/timecheck.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('business','','../../classfied/bossbusiness_f2.gif',1)"><img src="../../classfied/bossbusiness.gif" name="business" width="105" height="25" border="0"></a></td>



  </tr>



</table>





<table width="100%" border="0" cellpadding="0" cellspacing="0">



	<tr bgcolor="#000099"> 



		<td width="50%" height="29" align="right" valign="middle"></td>



		<td width="50%" valign="top"></td>



	</tr>



</table>





<table width="100%" height="350" border="0">
  <tr> 
    
    <td width="82%" valign="top"><font color="#FF0000"><strong>
	
	<?php if ($valid!=true)

					{echo ( $errmsg.$form);} else {

					

					

					

					$_POST['username']= stripslashes($username);

					

					$insert= "insert into members (username,password,member_type,business_name, business_add1, business_add2,
					
					business_town ,contact,email,postcode,area,home_tel,mobile_tel,

					datejoined,lastlog,valid) values ('$member', '$password','$type','$business_name', '$business_add1',
					'$business_add2', '$business_town','$contact', '$email' ,'$postcode','$area', '$num', 

					'$mobtel', now(), 'never' ,1)";

					

					mysql_query($insert,$db) or die("Cannot query the database.<br>" . mysql_error());
	
	mysql_close($db);

					header("location: business_complete.php?member=$member");}  ?>
	
	</font></strong>
      <fieldset>
      <legend>Add Business Member</legend>
	  <br><br>
	  
      <table width="70%" border="0" cellspacing="0" cellpadding="0"><tr>
        <td width="40%">Username</td><td width="50%"><form name="addbusiness" method="post" action="<?php $PHP_SELF ?>">
        <input type="text" name="member" value="<?php echo $_POST['member'] ?>" maxlength="20" size="20" ></td>
        <td width="10%"></td></tr>
      </table>
      <table width="70%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="40%">Password</td>
          <td width="60%"> <input type="password" name="password" maxlength="15" size="15"> 
          </td>
        </tr>
      </table>
      <table width="70%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="40%">Confirm Password</td>
          <td width="60%"> <input type="password" name="confirm" maxlength="15" size="15"> 
          </td>
        </tr>
        <tr> 
          <td width="40%">Member Type</td>
          <td width="50%"><select name="type">
              <option value="business">business</option>
              <option value="job">job</option>
              <option value="resturant">resturant</option>
            </select></td>
        </tr>
		<tr> 
          <td width="40%">Business Name</td>
          <td width="50%"> <input type="text" name="business_name"  value="<?php echo $_POST['business_name'] ?>" maxlength="29" > </td>
        </tr>
		<tr> 
          <td width="40%">Address 1</td>
          <td width="50%"> <input type="text" name="business_add1"  value="<?php echo $_POST['business_add1'] ?>"  maxlength="29"> </td>
        </tr>
        <tr> 
          <td width="40%">Address 2</td>
          <td width="50%"> <input type="text" name="business_add2" value="<?php echo $_POST['business_add2'] ?>" maxlength="29"> </td>
        </tr>
		<tr> 
          <td width="40%">Town</td>
          <td width="50%"> <input type="text" name="business_town" value="<?php echo $_POST['business_town'] ?>" maxlength="19"> </td>
        </tr>
        <tr> 
          <td width="40%">Postcode</td>
          <td width="50%"> <input type="text" name="postcode" value="<?php echo $_POST['postcode'] ?>" maxlength="10"> </td>
        </tr>
		<tr> 
          <td width="40%">Contact Name</td>
          <td width="50%"> <input type="text" name="contact" value="<?php echo $_POST['contact'] ?>" maxlength="20"> </td>
        </tr>
		<tr> 
          <td width="40%">Email</td>
          <td width="50%"> <input type="text" name="email" <?php echo $_POST['email'] ?> maxlength="40"> </td>
        </tr>
		<tr> 
          <td width="40%">Area Code</td>
          <td width="50%"> <input type="text" name="area" <?php echo $_POST['area'] ?> maxlength="6"> </td>
        </tr>
		<tr> 
          <td width="40%">Lan Phone</td>
          <td width="50%"> <input type="text" name="home_tel" <?php echo $_POST['home_tel'] ?> maxlength="15"> </td>
        </tr>
		<tr> 
          <td width="40%">Mobile Phone</td>
          <td width="50%"> <input type="text" name="mobile_tel" value="<?php echo $_POST['mobile_tel'] ?>" maxlength="15"> </td>
        </tr>
		
		<tr> 
		
          <td width="10%"><input type="submit"  name="submit" value="Add"></form>
          </td>
        </tr>
      </table>
      </fieldset>
</table>
<table width="100%" border="1" cellspacing="0" cellpadding="0" height="29" bordercolor="#FFFFFF" >
  <tr> 
    <td align="center" bgcolor="#00CC99" class="small"><a href="../raffle/raffle.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('raffle','','../../classfied/bossraffle_f2.gif',1)"><img src="../../classfied/bossraffle.gif" name="raffle" width="105" height="25" border="0"></a></td>
    <td align="center" bgcolor="#00CC99" class="small"><a href="../msg/msg.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('msg','','../../classfied/bossmsg_f2.gif',1)"><img src="../../classfied/bossmsg.gif" name="msg" width="105" height="25" border="0"></a></td>
    <td align="center" bgcolor="#00CC99" class="small"><a href="../approval/suspend/suspendedads.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('suspend','','../../classfied/bosssuspend_f2.gif',1)"><img src="../../classfied/bosssuspend.gif" name="suspend" width="105" height="25" border="0"></a></td>
    <td align="center" bgcolor="#00CC99" class="small"><a href="../news/addnews.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('addnews','','../../classfied/bosssaddnew_f2.gif',1)"><img src="../../classfied/bosssaddnew.gif" name="addnews" width="105" height="25" border="0"></a></td>
    <td align="center" bgcolor="#00CC99" class="small"><a href="../news/editnews.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('edit news','','../../classfied/bossseditnew_f2.gif',1)"><img src="../../classfied/bossseditnew.gif" name="edit news" width="105" height="25" border="0"></a></td>
    <td align="center" bgcolor="#00CC99" class="small"><a href="../../login/logout.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('boss','','../../classfied/bosslogout_f2.gif',1)"><img src="../../classfied/bosslogout.gif" name="boss" width="105" height="25" border="0"></a></td>
  
  
  
  </tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0" height="19">
  <tr>
    <td bgcolor="#000099" >&nbsp;</td>
  </tr>
</table>
</body>















</html>

<?php

mysql_close($db);



 } else { echo "$username You are not authorised to via this page"; 



mysql_close($db);}


ob_end_flush()?>


?>
this works fine