Jamesking56 Posted August 19, 2008 Share Posted August 19, 2008 I'm making a Forum Page so that it displays the Forum Rules (in a .txt file) then you have to Click "I Accept" to enter the ForumBut, I have used PHP to Compensate for Errors.I use Variables to Change Forum Link and the Forum Rules TXT File,But now, it won't open my Forum Rules TXT fileCan anyone help?Here is the Code: <?php include( 'inc/header.inc.php' ); include( 'inc/sidebar.inc.php' ); $forumrulestxt = "rules.txt"; $forumlink = "/forum";?> <!-- Begin Right Column --> <div id="rightcolumn"> <h2>Forum!</h2> <?php if ( !$forumlink | $forumlink="" | $forumlink="http://" ) { echo "<h4>Sorry, We currently Don't have a Forum Yet!</h4>"; } elseif ( !$forumrulestxt | !$forumrulestxt="" | $forumrulestxt="http://" ) { echo "<h4>Click the Link Below to Enter the Forum:<br /><br /><a href=\"" . $forumlink . "\" title=\"James's Forum\">Enter Forum</a></h4>"; } else { $forumrulestxt_open = fopen($forumrulestxt, "r"); if ( !$forumrulestxt_open ) { echo "An Error Occured..."; } $forumrulestxt_read = fread($forumrulestxt_open, "100000"); echo "<h4>Please Agree to the Forum Rules Below to Enter the Forum<br /><br /><textarea name=\"forumrules\">" . $forumrulestxt_read . "</textarea><br /><br /><input type=\"button\" name=\"agree\" value=\"I Agree\" OnClick=\"window.location($forumlink)\"/></h4>"; $forumrulestxt_close = fclose($forumrulestxt_open); } ?> </div> <!-- End Right Column --> <?php include( 'inc/footer.inc.php' ); ?> </div> <!-- End Wrapper --> </body></html> Link to comment Share on other sites More sharing options...
jeffman Posted August 19, 2008 Share Posted August 19, 2008 if ( !$forumlink | $forumlink="" | $forumlink="http://" ) --- elseif ( !$forumrulestxt | !$forumrulestxt="" | $forumrulestxt="http://" )Both of these statements use the assignment operator (=) when they should use the comparison operator (==). So the value of $forumrulestxt is probably getting trashed.When you get problems like this, always echo your variables to see what you're actually sending to your functions. Link to comment Share on other sites More sharing options...
Jamesking56 Posted August 19, 2008 Author Share Posted August 19, 2008 Yeah! Now the Textbox gets the Info from the TXT FileBut..I have another problem, The Button doesn't work, it is supposed to redirect you to the Forum Link but it doesn't do anything!Help me once more?? Link to comment Share on other sites More sharing options...
Lulzim Posted August 19, 2008 Share Posted August 19, 2008 window.location is not a method, so instead of <input type=\"button\" name=\"agree\" value=\"I Agree\" OnClick=\"window.location($forumlink)\"/> write <input type=\"button\" name=\"agree\" value=\"I Agree\" OnClick=\"window.location='$forumlink'\"/> Link to comment Share on other sites More sharing options...
Jamesking56 Posted August 19, 2008 Author Share Posted August 19, 2008 Yes it works!!Thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.