Hey there, I recently came accross a php code that logs all info submitted into all text boxes on a webpage. $handle = fopen("log.txt", "a"); foreach($_POST as $variable => $value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); Code (markup): Its going to be a registration form that will be asking questions. Presuming that username is the variable for username and fav_game is the variable for favorite game. How would I log these parts of the webpage rather than all of it.
$handle = fopen("log.txt", "a"); fwrite($handle, "username=".$_POST['username']); fwrite($handle, "\r\n"); fwrite($handle, "\r\n"); fwrite($handle, "fav_game=".$_POST['fav_game']); fwrite($handle, "\r\n"); fwrite($handle, "\r\n"); fclose($handle); PHP: Or if you wish to add some more fields to log in future $fields = array('username','fav_game'); $handle = fopen("log.txt", "a"); foreach($fields as $variable) { if(!isset($_POST[$variable])) continue; fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $_POST[$variable]); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); PHP: