<html> <body> <div style="background-color:green;width:200px;"> <b>Config Grabber BETA</b> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Are you ready?: <input name="go" size="0"> <input type="submit" name="submit" value="Go"> </form> <?php $rook = $_POST['go']; if ($rook > 0); { $file = includes/config.php; $result = file_get_contents($file); } echo "$result"; else { echo "Something went wrong...."; } ?> </div> </body> </html> Code (markup): I just want it to get the file and echo its contents
$rook = isset($_POST['go']) ? 1 : 0; Code (markup): The form element "go" is never given a value so the value of $_POST['go'] will be an empty string which in PHP land is equal to 0. <input name="go" size="0" value="1"> Code (markup): Will also work.
a lot of that code is wrong. Weak HTML form code, weak PHP code .. youre basically trying to put together a script and you dont know HTML forms or PHP that well .. keep learning. the two posts above are right. you have no value in your "name" field <input type="text" name="go" value="1234"> theres no ; after the rook variable where you should have a and your includes/config.php include('config.php'); keep learning.
this is correct as you said.. His intension is not to include files..but read the file from includes folder..what he has written is correct and you echo "$result"; should go inside if loop ...it shoould not be outisde of if loop before "else" statement... All the best..dont hesitate to more questions...
<html> <body> <div style="background-color:green;width:200px;"> <b>Config Grabber BETA</b> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> Are you ready?: <input name="go" size="0" value="1""> <input type="submit" name="submit" value="Go"> </form> <?php $rook = isset($_POST['go']) ? 1 : 0; if ($rook > 0) { $file = includes/config.php; $result = file_get_contents($file); echo $result; } else { echo "Something went wrong...."; } ?> </div> </body> </html> PHP: Is that alright?