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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:21:20+00:00 2026-05-25T11:21:20+00:00

At the moment, I have a form with an input (text) and a button

  • 0

At the moment, I have a form with an input (text) and a button to submit the form.

The form is posted to ‘submit.php’. I would like the form posted to same page as the form.

How can I do this?

<form action="submit.php" method="POST">
    <input type="text" class="emailField" placeholder="email address" name="email" />
    <button type="submit">
        <div class="submit" />
    </button>
</form>

submit.php

<?php
    mysql_connect('localhost', '', '') or die('unable to connect');
    mysql_select_db('') or die('unable to select db');
    $query = mysql_query("");
    if (mysql_num_rows($query) > 0) {
        exit("You have already subscribed!");
    }
    else {
        mysql_query("") or die(mysql_error());
        exit("You have successfully subscribed!");
    }

?>
  • 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-05-25T11:21:21+00:00Added an answer on May 25, 2026 at 11:21 am

    I think you have a couple of options here.

    Submit the form onto itself

    <?php
        if('POST' == $_SERVER['REQUEST_METHOD']) {
            // process the form here
        }
    ?>
    <form action="" method="POST">
        <input type="text" class="emailField" placeholder="email address" name="email" />
        <button type="submit">
            <div class="submit" />
        </button>
    </form>
    

    Redirect back to the form

    Add something like this in submit.php where you want to show the form.

    <?php
        header('Location: http://example.org/form.php');
        exit;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a HTML script like this: <form id=no1> <input id=title type=text /> <input
Can someone please explain this to me? I have the following code: <form action=<?php
Ok so i have a form that has three input boxes, at the moment
At the moment, I have this DIV with a registration form centered over the
<form method=post action=sendmail.php name=Email_form> Message ID <input type=text name=message_id /><br/><br/> Aggressive conduct <input type=radio
I have a HTML page containing a form which consists of; text, check boxes
At the moment I have a set of divs, generated dynamically by php and
I have a form which includes a JQUERY datepicker attatched to an <input> on
I have a JST-->EJS backbone template for a 'projects' form. Ideally, I'd like to
I built a basic form with ajax validation and page redirection with PHP and

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.