Hi guys want to make a form with 2 actions, means by 1 click 2 actions performs and I do not want to use PHP_SELF, because the first action address is the main target and the second one is to store data its my code but it doesn't store data in "test.txt" just posts to "http://mysite.com/11.php" <?php $st = " <form action='http://mysite.com/11.php' method='post'> Name: <input type='text' name='name' /> Age: <input type='text' name='age' /> <input type='submit' /> </form> "; echo $st; $name = stripslashes($name); $age = stripslashes($age); $logs = fopen('test.txt', 'a', 1); $mytext=" $name , $age "; fwrite($logs, $mytext); fclose($logs); ?> PHP: Thanks
Check this file1 $st = "<form action='http://mysite.com/file2.php' method='post'>Name: <input type='text' name='name' />Age: <input type='text' name='age' /><input type='submit' /></form>"; echo $st; file2 extract($_POST); $name = stripslashes($name);$age = stripslashes($age);$logs = fopen('test.txt', 'a', 1);$mytext="$name , $age ";fwrite($logs, $mytext);fclose($logs); header('location:http://mysite.com/11.php);
Thank you for the reply but it doesn't posts data to "http://mysite.com/11.php" it just writes in the file and after that redirects me to "http://mysite.com/11.php"
After you submit the form are you wanting to print out the posted data? try something like... if(isset($_POST)) { Print "<pre>"; Print_r($_POST); Print "</pre>"; } Code (markup): or if(isset($_POST['name'])) { Print $_POST['name']; } Code (markup):