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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:11:40+00:00 2026-05-30T03:11:40+00:00

When the user submits a form and there is an error, I want whatever

  • 0

When the user submits a form and there is an error, I want whatever they typed to remain in the text box so they can edit it instead of re-typing it. I’m trying to use a hidden field to store this value.

echo '<table><form method="post" action="" name="groupInvite"> 
      <tr><td>Event Title:</td><td> <input type="text" name="eventTitle" value = "'.$_POST['hiddenTitle']. '"></td><td>';
      $hiddenTitle = $_POST['eventTitle'];
      echo '<input type="hidden" name="hiddenTitle" value = "' .$hiddenTitle. '">';
  • 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-30T03:11:42+00:00Added an answer on May 30, 2026 at 3:11 am

    This:

    <input type="hidden" name="hiddenTitle" value = "'<? $_POST['eventTitle'] >?'">
    

    Should be:

    <input type="hidden" name="hiddenTitle" value="<?= $_POST['eventTitle'] ?>" />
    

    The <?= is the same as <? echo. You also had the closing tag mixed up, and you’ve got single quotes inside the double quotes – I’m assuming you didn’t need those so I’ve removed them, but if you meant to have those displayed in the text box you can still add them back.

    The previous text element will also need <?= instead of <?


    When you’ve submitted your form, everything is held in the $_POST array (assuming you’re posting the form).

    In your form, you have a textbox that the user fills in, and then submits. Only once it;s submitted will the $_POST array be filled, so all you need to do is this:

    <table><form method="post" action="" name="groupInvite">
    <tr><td>Event Title:</td><td> <input type="text" name="eventTitle" value="<? if(isset($_POST['eventTitle']) && trim($_POST['eventTitle']) != ''){ echo $_POST['eventTitle']; } ?>"></td><td>
    

    We check to see if the $_POST['eventTitle'] exists (If the form was submitted basically), and that it’s not empty. If thats the case, we echo out it’s contents into the value of the textbox.

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

Sidebar

Related Questions

I have form where user submits field. Field can have letters, numbers, and punctuation.
I want to disable the submit button when a user submits the form so
I have situation like this: user submits form with action='/pay' in '/pay' I have
After a user submits a form, how do you detect that the form has
So the chain of events is: The user submits a form. During the processing
I am using FirePHP with Zend Framework. When the user submits a form, I
I have a website with a contact form. User submits name, email and message
I have a form, and a submit handler in jQuery. When the user submits
I have a form, when user submit the form, I want to direct the
i have a form and a sortable() list where a user can drag from

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.