Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling of new page....

Status
Not open for further replies.

meenakshidhar

Programmer
Oct 19, 2001
77
MY
hello friends,

i want to call a new page without using submit button...i m sending u my code....in this code when user successfully login, a new page should be displayed...


<HTML><HEAD><TITLE>Untitled Document</TITLE>
</HEAD>
<BODY class=background bgColor=#ffffff>
<form method=post action=&quot;login1.php&quot;>
<TABLE height=164 width=&quot;41%&quot; align=center border=1>

<TR borderColor=#ccffff>
<TD class=tableheading height=27>Login</TD></TR>
<TR vAlign=top borderColor=#ccffff>
<TD class=tabledata height=163>
<P>                                   
<BR>            UserName:

<INPUT type=text name=username> </P>
<P>            Password:
 

<INPUT type=text name=password> </P>
<P>                    
    

<INPUT type=submit value=Login name=submit> <INPUT type=reset value=Clear> </P></TD></TR></TBODY></TABLE>
<P> </P>
</form>
</BODY>
</HTML>


<?php

$connection=mysql_connect(&quot;localhost&quot;,&quot;vivek&quot;,&quot;tarun150&quot; )
or die ( &quot;Unable to connect to server.&quot; );
$db_name=&quot;vivek&quot;;

$table_name=&quot;authentication&quot;;
$db=mysql_select_db($db_name,$connection)
or die ( &quot;Unable to select database.&quot; );
$sql=&quot;SELECT * FROM $table_name WHERE
username ='$username' AND
password = '$password'&quot;;
$result =mysql_query($sql)
or die(&quot;Unable to execute query.&quot;);
$num = mysql_num_rows($result);
if ( $num != 0 )
{

header(&quot;location:
}
else{
echo &quot;sorry&quot;;

exit;
}
?>

here header function is used to display form...the problem is in this line only...plsss help...
 
Hmmm, this board adds an extra semi-colon to that line which should not be there.
 
hi,

be sure that u are not passing any headers to the browser before you use header(&quot;location...),even a blank line can cause a problem.



regards
spookie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top