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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:36:42+00:00 2026-06-11T21:36:42+00:00

I have a page that called admin.php that has some cods and buttons. my

  • 0

I have a page that called admin.php that has some cods and buttons. my problem is one of the buttons apply an action code that is originally HTML code but i converted it to php and the code is like this:

echo "<form action=\"write.php\" method=\"post\">\n"; 
echo " <p>your MoD name: <input type=\"text\" name=\"mdname\" /></p>\n"; 
echo " <p><input type=\"submit\" /></p>\n"; 
echo "</form>\n"; 

this code calls the write.php and write.php code is this:

<?php
header ('Location: admin.php ');
$myFile = "methods\actmod.txt";
unlink($myFile);
$handle = fopen("methods\actmod.txt", "a");
foreach($_POST as $variable => $value) {
   fwrite($handle, $variable);
   fwrite($handle, "=");
   fwrite($handle, $value);
   fwrite($handle, "\r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>

this code writes some data to txt file that called actmod.txt and returns to the admin page. i wanted to ask is there any way that i can merge write.php to the main admin.php page so when i hit the submit button in the admin page it won use any external file and runs the commands directly from admin page and i wont have any external files behind the admin page?

i have seen lots of pages that has address like this “http://site.com/admin.php?act=write

i hope every body understand what i mean. i am new to php and i searched a lot and i appreciate to anybody’s help.
thank you

  • 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-11T21:36:43+00:00Added an answer on June 11, 2026 at 9:36 pm

    In your admin.php

    <?php
    $post = count($__POST) > 0 ? true : false;
    if ($post) {
        // do the work you are doing in write.php
    } else {
       // do the work you are already doing in admin.php
    }
    

    There may be better ways to identify the request being POST or GET, I am just trying to give you a hint and rest is yours. 🙂

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

Sidebar

Related Questions

The problem: I have a jQuery heavy page that has a built in admin
I have a parent object called Page that has a List of objects called
I have a file called header.php that I am including on every page on
I have a simple page in a PHP/MySQL web application that lets admin users
I have a page called /add that you can add a Dog on and
For example, I have a page in my application called page2 that I want
I have a class that inherits from Page, called APage. public abstract class APage:
I have a custom user control called ErrorNotificationBox. To place that on my page
Let's assume that we have a PHP class Page , which generates PHP Page
I have a project which has Area called Admin. There is a class called

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.