joshgom Posted June 19, 2020 Share Posted June 19, 2020 After I input a number and press submit, it'll do some calculating and write the number to a file. Once its done I want it to go to another page but it doesn't seem to work. Ive tried header with no luck . Heres my code: $number = $_POST['number-entered']; foreach ( range(1, $number) as $i ) { $triangle_numbers[] = $i * ( $i + 1 ) / 2; } //make a file $contents = fopen('gs://a1-task22020.appspot.com/triangular_' .$number. ".txt", "w"); fwrite($contents,implode(',', $triangle_numbers)); //open the file $contents = fopen('gs://a1-task22020.appspot.com/' . $content, 'w'); //re-open the document if you put something in it fwrite($contents, $number); fclose($contents); } header("Location: https://a1-task22020.ts.r.appspot.com/result.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/310965-how-to-redirect-page-after-submission/ Share on other sites More sharing options...
cyberRobot Posted June 19, 2020 Share Posted June 19, 2020 Are you getting any errors? Is PHP set to output all errors? Perhaps the call to header() isn't being executed. Have you tried outputting something right before the call to header()? Quote Link to comment https://forums.phpfreaks.com/topic/310965-how-to-redirect-page-after-submission/#findComment-1579010 Share on other sites More sharing options...
dodgeitorelse3 Posted June 27, 2020 Share Posted June 27, 2020 what do the curly brackets before and after header go to? Quote Link to comment https://forums.phpfreaks.com/topic/310965-how-to-redirect-page-after-submission/#findComment-1579230 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.