spires Posted October 30, 2006 Share Posted October 30, 2006 Hi, I have built a loging system, This works fine. You type in your details, Which POSTs the values back to the same page, checks to see if there in the database, then it registers the sessions and (using a header) sends you to the next page.However, if i do any php selecting from the database below the form, the sessions DO NOT register. Has anyone ever seen this before?If so, why does it do this?Here is an example of what i mean.The top section pulls the info out of the database. This only works if its above the form. If i use it below the form (Where the variables are) It dont work.[code]<?php$cstyle_query = mysql_query("SELECT * FROM choosen_style") or die (mysql_error());$cstyle_row = mysql_fetch_array($cstyle_query);$cstyle_id = $cstyle_row['csty_id'];$style_query = mysql_query("SELECT * FROM styles WHERE sty_id='$cstyle_id'") or die (mysql_error());$style_row = mysql_fetch_array($style_query);$style_id = $style_row['sty_id'];$foot = $style_row['foot'];$pole2 = $style_row['pole2'];?><form name="form2" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <div align="center"> <br> <br> <br> <table width="185" height="102" border="0" cellspacing="0" cellpadding="0" background="JPGS/tags/members.jpg"> <tr> <td valign="middle"> <center> <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e5eaee"> <tr> <td colspan="3"> <div align="center" class="layerText">MEMBERS AREA</div> </td> </tr> <tr> <td class="small2"> Login: </td> <td colspan="2"> <div align="left"> <input name="username" type="text" size="14" id="username" value="<?php $_POST['username']; ?>"> </div></td> </tr> <tr> <td class="small2"> Password: </td> <td colspan="2"> <div align="left"> <input name="password" type="password" size="14" id="password" value="<?php $_POST['password']; ?>"> </div></td> </tr> <tr> <td colspan="3"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="112"><a href="forgot_your_password.php" class="link">Forgot your password?</a> </td> <td width="64" valign="middle"> <input name="submit_butt" type="submit" value="Submit"> </td> </tr> </table> </td> </tr> </table> </center> </td> </tr> </table> </div> </form> <td height="21" colspan="5" background="JPGS/top_navi/<?php echo $pole2; ?>"> </td> </tr> <tr> <td height="30" colspan="5" background="JPGS/footers/<?php echo $foot; ?>"> <table width="100%" cellspacing="5"> <tr> <td width="10"> </td> <td> <span class="white">Copyright © 2006 eventindustires.com All Right Reserved.</span> </td> <td align="right"> <div align="right"><a href="terms.php" class="white_link">Terms of use</a> <span class="white">- <a href="mailto:[email protected]" class="white_link">Contact us</a></span> </div> </td> <td width="10"> </td> </tr> </table> </td> </tr> <tr> <td width="22" height="27"></td> <td width="363"> <p><span class="error"> Created by Spires1</span><br> <a href="http://www.spires1.com" target="_blank" class="link">web and graphic design</a></p> </td> <td width="316"></td> <td width="22"></td>[/code]Thanks for any advice. Link to comment https://forums.phpfreaks.com/topic/25603-quick-question-strange-problem/ Share on other sites More sharing options...
HuggieBear Posted November 1, 2006 Share Posted November 1, 2006 It should be fine, so what error occurs when you try this?[code]<form name="form2" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <div align="center"> <br> <br> <br> <table width="185" height="102" border="0" cellspacing="0" cellpadding="0" background="JPGS/tags/members.jpg"> <tr> <td valign="middle"> <center> <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#e5eaee"> <tr> <td colspan="3"> <div align="center" class="layerText">MEMBERS AREA</div> </td> </tr> <tr> <td class="small2"> Login: </td> <td colspan="2"> <div align="left"> <input name="username" type="text" size="14" id="username" value="<?php $_POST['username']; ?>"> </div> </td> </tr> <tr> <td class="small2"> Password: </td> <td colspan="2"> <div align="left"> <input name="password" type="password" size="14" id="password" value="<?php $_POST['password']; ?>"> </div> </td> </tr> <tr> <td colspan="3"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="112"><a href="forgot_your_password.php" class="link">Forgot your password?</a> </td> <td width="64" valign="middle"> <input name="submit_butt" type="submit" value="Submit"> </td> </tr> </table> </td> </tr> </table> </center> </td> </tr> </table> </div></form><?php$cstyle_query = mysql_query("SELECT * FROM choosen_style") or die (mysql_error());$cstyle_row = mysql_fetch_array($cstyle_query);$cstyle_id = $cstyle_row['csty_id'];$style_query = mysql_query("SELECT * FROM styles WHERE sty_id='$cstyle_id'") or die (mysql_error());$style_row = mysql_fetch_array($style_query);$style_id = $style_row['sty_id'];$foot = $style_row['foot'];$pole2 = $style_row['pole2'];?> <td height="21" colspan="5" background="JPGS/top_navi/<?php echo $pole2; ?>"> </td></tr><tr> <td height="30" colspan="5" background="JPGS/footers/<?php echo $foot; ?>"> <table width="100%" cellspacing="5"> <tr> <td width="10"> </td> <td> <span class="white">Copyright © 2006 eventindustires.com All Right Reserved.</span> </td> <td align="right"> <div align="right"><a href="terms.php" class="white_link">Terms of use</a> <span class="white">- <a href="mailto:[email protected]" class="white_link">Contact us</a></span> </div> </td> <td width="10"> </td> </tr> </table> </td></tr><tr> <td width="22" height="27"> </td> <td width="363"> <p><span class="error">Created by Spires1</span><br><a href="http://www.spires1.com" target="_blank" class="link">web and graphic design</a> </p> </td> <td width="316"></td> <td width="22"></td>[/code]RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/25603-quick-question-strange-problem/#findComment-117775 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.