Jump to content

How to redirect page after submission

Recommended Posts

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);
 header("Location: https://a1-task22020.ts.r.appspot.com/result.php");



Share this post

Link to post
Share on other sites

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()?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.