Jump to content

Problem Getting a TXT File in a Textbox on Webpage


Jamesking56

Recommended Posts

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...