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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:10:11+00:00 2026-06-13T07:10:11+00:00

Hi I have a structure as follows. The issue is once the error message

  • 0

Hi I have a structure as follows. The issue is once the error message is displayed, the text box content disappears and need to re-type a value again. I need to retain the original text box value/content as it is whilst the message is displayed. How do you think I should change? Thanks.

    <?php 
if(isset($_POST['subN'])) {
$InNo = $_POST['invc_no'];

$MSG = '';
if($InNo == "") 
{$MSG = 'Invoice number is required';} 
else
{//some code to save data to a database}
?>

<!DOCTYPE html>
<head><title></title></head>
<body>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div id="msgBox"><?php if(!empty($MSG)) echo $MSG; ?></div>
<table>
<tr>
<td><input type="text" id="invc_no" name="invc_no" size="15" class="colr" value="<?php htmlentities('InNo')?>"></td>
<td><input type="submit" name="subN" id="subN" value="Save"></td>
</tr>
</table>
</form>
</body>
</html>
  • 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-13T07:10:12+00:00Added an answer on June 13, 2026 at 7:10 am

    Change

    <input type="text" id="invc_no" name="invc_no" size="15" class="colr" value="<?php htmlentities('InNo')?>">
    

    To

    <input type="text" id="invc_no" name="invc_no" size="15" class="colr" value="<?php echo htmlentities($_POST['invc_no'])?>">
    

    Second Solution:

    Put as below

    $InNo = ''; // if you doesn't put any value into text box, then you will get undefined error while you use this variable later on so give initial value to null
    
    if(isset($_POST['subN'])) {
     continue ....
    }
    else{
     continue ..
    }
    
    <input type="text" id="invc_no" name="invc_no" size="15" class="colr" value="<?php echo htmlentities($InNo); ?>">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder structure as follows: mydomain.example ->Folder-A ->Folder-B I have a string
I have the enum structure as follows: public enum MyEnum { One=1, Two=2, Three=3
I have a directory structure as follows Client_Site/ some_folder1/ some_folder2/ some_folder3/ Lots of files
I have a python data-structure as follows: A = [{'abc': 'kjkjl'},{'abc': 'hjhjh'},{'abc': '78787'}] How
I have a class with a structure as follows: class Test { private $var1;
I have a table and the structure of it is as follows: VoteId QuestionId
I have table structure as follows id productid ip hittime --------------------------------------------------------------------------- 1 5 1.1.1.1
I have a data structure as follows: I have a list of objects with
I'm building a site using mvc2 and have a structure like follows: Factory ->
The issue I have is as follows: My company's supplier gives us an Access

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.