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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:19:40+00:00 2026-06-09T22:19:40+00:00

The form below can contains different elements of text fields, drop down and selection

  • 0

The form below can contains different elements of text fields, drop down and selection boxes, which allows the user to update his profile. The process of updating MySQL fields is being done after form submits.

<form method="post">
My Name: <input name="myname" type="text" value="<?php echo $_SESSION['SESS_MY_NAME']; ?>" /><br />
My Email: <input name="email" type="text" value="<?php echo $_SESSION['SESS_EMAIL']; ?>" /><br />
    <input type="submit" name="Submit" value="Update" />

<?php
if (isset($_POST['Submit'])) {
    // MySQL update
    ;
    ;
    ;
    $result=mysql_query($sql);
  }

// if successfully updated, make form refresh. 
  if($result){
    ;
    ;
    ;
  }
?> 
</form>

I want to refresh only the form, so that the user will stay in the same page and will see the changes that he made (i.e. What do I need to put under the comment in the code “if successfully updated, make form refresh”?).

I cannot use header("location: samepage.php"); because I have too many HTML codes involved in between and before.

Appreciate any help,

  • 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-09T22:19:42+00:00Added an answer on June 9, 2026 at 10:19 pm

    Move the isset($_POST['submit']) check to the top.

    Your current (intended) process is as follows:

    1. Retrieve form data from DB/Session/etc.
    2. Display as HTML
    3. User submits form
    4. Repeat steps 1/2
    5. Write data to DB
    6. Force refresh
    7. Repeat 1/2 again

    If you move this check to the top, the process is changed to:

    1. Retrieve form data from DB
    2. Display as HTML
    3. User submits form
    4. Write data to DB
    5. Repeat 1/2 (it will now retrieve the updated information and display correctly).

    This is the absolute simplest way you can do it. It doesn’t take into account Post/Redirect/Get or updating the session so multiple DB reads are unncessary, etc.

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

Sidebar

Related Questions

I'm creating a dynamic form with javascript which contains a drop down list and
i have a pretty complicated form. as you can see below: alt text http://img9.imageshack.us/img9/2465/test2xk.jpg
Form contains two dropdown lists created using code below. Both dropdown list elements have
I have a table with a form below it. You can fill out the
I am creating a dropdown contact form and you can view the code below:
For the below code, there ia a form in the location /home/form.php .How can
In the dialog form below, I have 2 buttons: Save & Cancel. When user
I have a form which contains a whole bunch of checkboxes and some other
I have an asp.net content form which contains a couple of textboxes. I need
Currently I am working on one form which contains 2 buttons. Clicking on 1

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.