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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:56:31+00:00 2026-05-27T16:56:31+00:00

The scenario: I’ve made a long form with lots of inputs and drop down

  • 0

The scenario:

I’ve made a long form with lots of inputs and drop down selects, and I’ve already set it up to check to see if the form has been submitted and come back (due to errors and such) and use php to echo the values back into the appropriate inputs. Something like:

<input type="text" id="firstname" name="firstname" maxlength="60" value="<?php if(isset($_POST['submit'])){ echo trim($_POST['firstname']);} ?>">

once the form is submitted it goes into the database. Now i need to design a way for the user to come back and edit the information again, and rather than build an entirely new page to read the data from the db and echo it when the form is first loaded, then echo out the $_POST data if the form is submitted, but returned with errors, I’d like to use the same form and when the page loads, check the db to see if there are any entries for the current logged in user, and if so, set the $_POST variables to the values in the db.

I’ve written a quick test form and know that this is possible, but was wondering if it was considered improper to set the $_POST variable for this. The test code i wrote looks something like:

$query = "SELECT * FROM userprofiles WHERE uid = '$uid'";

        $result = mysql_query($query);

        if(mysql_num_rows($result) <= 0)
        {
            mysql_close(); //no info in db for user. Yet...
        }
        else
        {
            $data = mysql_fetch_array($result);
            $_POST['submit'] = true; 
            $_POST['firstname'] = $data['firstname']; //and so on...

This way I’m able to use the same form without having to modify a ton of code, and build a new page.

  • 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-27T16:56:31+00:00Added an answer on May 27, 2026 at 4:56 pm

    I do not see any problem in manually setting the post variables to serve your purpose, you may get to some logic problems if you are not paying attention, but in the end they are still variables. I think it is the same as you would save the $_POST in another variable first and work with it.

    The only difference is that $_POST is a super global ( http://php.net/manual/en/language.variables.superglobals.php ).

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

Sidebar

Related Questions

Scenario: I have an application that has a config table which stores the config
Scenario : A Customer entity has properties for State and Color . i.e. Washington
Scenario: I found the awesome Console2 http://sourceforge.net/projects/console/ and set about making three environments for
Scenario: I have a TFS Build (TFS2008) that has several targets override: BuildNumberOverrideTarget, AfterGet,
SCENARIO (iOS 5) I currently have a UITableView. It has 30 table rows The
Scenario The system has classes declared in /system/classes/ . The application has classes declared
Scenario: I'm working on a solution that has many assemblies. The main assembly references
Scenario : I'll try to put an analogy with the loan broker example from
Scenario first :- I'm using Entity Framework to do some queries, to build my
Scenario: There is a website with 700-900 concurrent unique visitors at any given time.

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.