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 8005257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:10:39+00:00 2026-06-04T17:10:39+00:00

I have been searching for hours on how to do this, and am asking

  • 0

I have been searching for hours on how to do this, and am asking for help on what I would like to do.

I would like to dynamically create a file, based on form submitted data using radio buttons as the variable.

For example:

if ($_POST['radio_button_selection'] == "percussion") {

file_put_contents("dynamic_filename.txt", $_POST['radio_button_selection']);

echo "Dynamic filename created";

}

I tried:

if ($_POST['radio_button_selection'] == "percussion") {

file_put_contents("({$_POST['percussion']})", $_POST['radio_button_selection']);

echo "Percussion file created.";

}

But this is not working.

I know I have a missing piece of code to give it the extension, but I don’t know how to do it.

Any help is greatly appreciated.

Thank you.

(EDIT)
Do I need to modify this with PHP code in order to create the file “percussion” as well as write data in the file of the same name?

<input type="radio" value="percussion" name="musictype">Percussion

For example, create the file “percussion.txt” with the word “percussion” in the file.

The code below works and creates the file “percussion.txt” and writes the word “percussion” in the file, but I need the file to be created dynamically while writing to it at the same time.

file_put_contents("percussion.txt", $_POST['musictype'] . "\n", FILE_APPEND);
  • 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-04T17:10:40+00:00Added an answer on June 4, 2026 at 5:10 pm

    Bsdnoobz just has it switched.

    file_put_contents($_POST['radio_button_selection'].'.txt', $_POST['percussion']);
    

    Make sure the folder you are writing to has write permission.

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

Sidebar

Related Questions

I have been searching to a resolution to this for hours, but I still
I have been searching for a solution for this issue for multiple hours today
I have been searching for hours but I can't seem to understand why this
ok this is very simple yet have been searching for 3 hours and still
I have been working on this for the past couple of hours, and searching
I have been searching for several hours now how to do this, but can't
I have been reading stackOverflow answers for this question for hours. Please help me.
I have been searching for a couple hours for a way to accomplish this
I have been searching for a few hours and cant seem to find answer
I have been searching for the last few hours, and unfortunately I cannot seem

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.