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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:09:01+00:00 2026-06-03T15:09:01+00:00

I have a form that send information to a mysql db. Error messages and

  • 0

I have a form that send information to a mysql db. Error messages and a confirmation appear to the right of the form in a seperate div so the form action needs to send the user to the same page. I am echoing the field the user types in in case they need to edit something based on the error message that appears. However, if the form is submitted correct, how could i make it so the php does not echo in the form?

<?php

$submit = filter_input(INPUT_POST, 'submit');
//form data
$fullname = filter_input(INPUT_POST, 'fullname');
$email = filter_input(INPUT_POST, 'email');
$business = filter_input(INPUT_POST, 'business');
$date = date("Y-m-d");

?> 

then after other html code….

  <div class="wrap">
      <div id="reg">

  <form action='register.php' method='POST'>
<table>
    <tr>
        <td>
        Your full name:
        </td>
        <td>
        <input type='text' name='fullname' value='<?php echo $fullname;?>'>
        }
        </td>

    </tr>
    <tr>
        <td>
        Your email:
        </td>
        <td>
        <input type='text' name='email' value='<?php echo $email;?>'>
        </td>

    </tr>

    <tr>
        <td>
        Your business:
        </td>
        <td>
        <input type='text' name='business' value='<?php echo $business;?>'>
        </td>

    </tr>






 </table>
 </br>
 <input type='submit' name='submit' value='Register'>

</form>
 </br>       

    </div>
    <?php
 if ($submit)
  {
    //open database
  $connect=mysql_connect("localhost","root","Ryweb1994");
  mysql_select_db("phapsy");


  //check for existence
if($fullname&&$business&&$business)
{

   $queryreg = mysql_query("INSERT INTO users VALUES                           ('','$fullname','$email','$business','$date')");
    echo ("<div id='message'><p>You have been registered! We will send you an email            with login information. Thank you for your interest in Phapsy!<p></div>");

   }
else echo "Please fill in <b>all</b> fields!";

   }


  ?>
    </div>
  </div>
  • 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-03T15:09:04+00:00Added an answer on June 3, 2026 at 3:09 pm

    Just wrap your form around with the $submit variable:

    + <?php if($submit) { ?>
     <div class="wrap">
      ... 
      <form action='register.php' method='POST'>
      ...
      </form>
    </div>
    + <?php }; ?>
    
        <?php
     if ($submit)
      {
        //open database
      $connect=mysql_connect("localhost","root","Ryweb1994");
      mysql_select_db("phapsy");
    
    
      //check for existence
    if($fullname&&$business&&$business)
    {
    
       $queryreg = mysql_query("INSERT INTO users VALUES                           ('','$fullname','$email','$business','$date')");
        echo ("<div id='message'><p>You have been registered! We will send you an email            with login information. Thank you for your interest in Phapsy!<p></div>");
    
       }
    else echo "Please fill in <b>all</b> fields!";
    
       }
    
    
      ?>
        </div>
      </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an incoming soap message wich form is TStream (Delphi7), server that send
I have an application that will form a packet and send the packet data
I have a simple html form that submits information with POST function. But when
I have a website with a form that uses PHP to send the form
I have a form that I want to use to collect user information. I
I am attempting to send different error messages back to an HTML DIV depending
I have a couple things going on right now. I have a form that
I have a form I am creating and I would like to send information,
I have a form that is broken down into three different categories: Information, Violations,
I have a form that collects information from several models that are several layers

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.