digitalLotus Posted April 18, 2007 Share Posted April 18, 2007 I'd like to know how I can have information written on two separate files after filling out a form. Right now it works fine with one file, shown in this code: $out = fopen("saved_data.php", "a"); if (!$out) { print("Could not append to file"); exit; } fputs ($out,implode,("\n")); fwrite($out,"<tr><td class=\"col01\">$name</td><td class=\"col02\">$gender</td><td class=\"col03\">$stat</td><td class=\"col04\">$country</td><td class=\"col05\">$city</td><td class=\"col06\">$sponsors</td><td class=\"col07\">$giant | $special | $tight</td></tr>"); fclose($out); } However, there's certain information I'd like to have on another txt file. Again, thanks in advance. Cheers Link to comment https://forums.phpfreaks.com/topic/47643-write-information-on-two-separate-files/ Share on other sites More sharing options...
per1os Posted April 18, 2007 Share Posted April 18, 2007 ummm??? <?php $out = fopen("saved_data.php", "a"); if (!$out) { print("Could not append to file"); exit; } fputs ($out,implode,("\n")); fwrite($out,"<tr><td class=\"col01\">$name</td><td class=\"col02\">$gender</td><td class=\"col03\">$stat</td><td class=\"col04\">$country</td><td class=\"col05\">$city</td><td class=\"col06\">$sponsors</td><td class=\"col07\">$giant | $special | $tight</td></tr>"); fclose($out); } $out = fopen("saved_data2.php", "a"); if (!$out) { print("Could not append to file"); exit; } fputs ($out,implode,("\n")); fwrite($out,"write other data here"); fclose($out); } ?> ??? Link to comment https://forums.phpfreaks.com/topic/47643-write-information-on-two-separate-files/#findComment-232666 Share on other sites More sharing options...
digitalLotus Posted April 18, 2007 Author Share Posted April 18, 2007 I tried that out before I posted here and what simply bothered me was the fact that it didn't work somehow. Well, I'll give it another try, but thanks anyways. Link to comment https://forums.phpfreaks.com/topic/47643-write-information-on-two-separate-files/#findComment-232672 Share on other sites More sharing options...
digitalLotus Posted April 18, 2007 Author Share Posted April 18, 2007 Here's the complete code of the test file. As soon as I add the part for the second file, it doesn't work anymore. <?php session_start(); $name = $_GET['name']; $day = $_GET['dd']; $month = $_GET['mm']; $year = $_GET['yyyy']; $gender = $_GET['gender']; $stat = $_GET['stat']; $country = $_GET['country']; $city = $_GET['city']; $sponsors = $_GET['sponsors']; $mail = $_GET['mail']; $giant = $_GET['giant']; $special = $_GET['special']; $tight = $_GET['tight']; $random = trim($_GET['random']); if ($_SESSION['new_string'] == $random){ echo "Thank you for signing up."; $out = fopen("saved_data.php", "a"); if (!$out) { print("Could not append to file"); exit; } fputs ($out,implode,("\n")); fwrite($out,"<tr><td class=\"col01\">$name</td><td class=\"col02\">$gender</td><td class=\"col03\">$stat</td><td class=\"col04\">$country</td><td class=\"col05\">$city</td><td class=\"col06\">$sponsors</td><td class=\"col07\">$giant | $special | $tight</td></tr>"); fclose($out); } else{ echo "Please reenter the code."; }?> Link to comment https://forums.phpfreaks.com/topic/47643-write-information-on-two-separate-files/#findComment-232685 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.