Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:13:11+00:00 2026-06-11T05:13:11+00:00

I’m writing a simple order system where several numbers (filled in inside a form)

  • 0

I’m writing a simple order system where several numbers (filled in inside a form) are written to another .php file (may be .html also), using the fopen function. This works fine, but after writing to the file, I want the browser to actually open that written file, preferably in a new browser window. This way my client can use this to print, use as an invoice, etc.

Now I’m still a rookie on php grounds and am not experienced with the use of fopen. But everywhere I look for tutorials etc., it’s said that fopen opens (or writes of course) a file, but it doesn’t for as far as I’ve experienced. It just seems to allow access to the specified file to write and read, rather to actually display the newly written page.

To avoid any confusion: I do NOT want to open links like other questions here on SO state.

My code:

<form action="" method="post">
  <input type="text" id="amountTuna" name="numberTuna" value="0"/>
  <input type="text" id="amountCheese" name="numberCheese" value="0"/>
  <input name="send" id="send" type="submit" value="Post order" />
</form>

<?php
if (array_key_exists('send', $_POST)) { 
  $order = "order.php";
  $fh = fopen($order, 'w') or die("can't open file");//file handler

  fwrite($fh, "Tuna sandwiches: " . stripslashes($_POST['numberTuna']));
  fwrite($fh, "Cheese sandwiches: " . stripslashes($_POST['numberCheese']));

  $fh = fopen($factuur, 'r');
  $fileip = fread($fh, filesize($factuur));
  fclose($fh);
}
?>

Trying different fopen parameters such as 'w','r','r+' etc doesn’t seem to make any difference. Removing fclose($fh) doesn’t seem to make any difference either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:13:13+00:00Added an answer on June 11, 2026 at 5:13 am

    Use JS script to open new window. For example right after fclose($fh):

    echo "<script>window.open($order, '_blank'); window.focus();</script>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.