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

  • Home
  • SEARCH
  • 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 8970161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:41:34+00:00 2026-06-15T17:41:34+00:00

I know this is a relatively basic question, but I cannot seem to find

  • 0

I know this is a relatively basic question, but I cannot seem to find a complete answer anywhere. How may I submit an HTML form to a flat .txt file without changing the content of the browser, besides a reload. Here is the content of my form inside my HTML file:

<form name="input" action="form.php" method="post">
Zip: <input type="text" name="zip">
<input type="submit" value="Submit">
</form>

and here is my php:

<?php

$myFile = "data.txt";

$fh = fopen($myFile, 'a');

$zip = $_POST["zip"];

$comma_delmited_list = explode(",", $zip) . "\n";

fwrite($fh, $comma_delmited_list);

fclose($fh);

?>

where form.php, data.txt, and the .html file are in the same directory, any help is appreciated. Thanks.

  • 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-15T17:41:35+00:00Added an answer on June 15, 2026 at 5:41 pm

    If you are seeing PHP code in your browser, then the server (if there is one) is not set up to handle PHP content. Did you install PHP? What is the environment you are using? Apache? nginx? Go Daddy, or some other host?

    To do what you actually want (once your environment works properly)…

    You need to use AJAX to do what you’re asking. Go read about jQuery or some other JavaScript library, or even just use basic JavaScript. It’s not that hard to do. The PHP file would run in the background and create your file, while your page stared blankly at you, unless you do something to indicate that the file was created.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this may sound relatively basic question, but still wanted to ask. I
This is a very basic html question, but I can't seem to locate the
I know this is probably something simple but I can't seem to find anything
I realise that this question may be almost impossible to answer definitively, but: Is
Know this might be rather basic, but I been trying to figure out how
i know this is a stupid question but i d'ont know how to do
I know this is an old question, but I have spend any hours on
I know this is repeated question on Stack. But in my case the URL
I know this is an easy concept, but I just can't seem to get
I think this is very basic CSS question . But here is the fiddle

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.