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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:35:02+00:00 2026-06-13T18:35:02+00:00

I have a html form. Following is my html code. How do i selected

  • 0

I have a html form. Following is my html code.

How do i selected civil status if user forgot to put other field information.

Ex: user select civil status, put first name but forgot to put last name. Then It’s show a error message “Please select your last name”. But when it’s show the error message then selected item is empty. How do i selected the civil item with php.

<tr>
   <td width="400">Status</td>
   <td>
      <select name="civil_status">
         <option value="">Select..</option>
         <option value="mr.">Mr.</option>
         <option value="mrs.">Mrs.</option>
         <option value="miss">Miss</option>
      </select>
   </td>
</tr>
<tr>
   <td>Last Name</td>
   <td><input type="text" name="l_name" value="<?php if(isset($_POST['l_name'])) echo 
         $_POST['l_name']; ?>" class="tr2" /></td>
</tr>
<tr>
   <td>First Name</td>
   <td><input type="text" name="f_name" value="<?php if(isset($_POST['f_name'])) echo 
         $_POST['f_name']; ?>" class="tr2" /></td>
</tr>
  • 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-13T18:35:03+00:00Added an answer on June 13, 2026 at 6:35 pm

    I would do:

    <select name="civil_status">
    <option value="">Select..</option>
    
    <?php
    
    $options = array('mr.' => 'Mr.', 'mrs.' => 'Mrs.', 'miss' => 'Miss');
    
    foreach($options as $key => $value){
    
        if($_POST['civil_status'] == $key){
            echo '<option value="'.$key.'" selected="selected">'.$value.'</option>';
        }else{
            echo '<option value="'.$key.'">'.$value.'</option>';
        }
    
    }
    
    ?>
    
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following multi-select box in a HTML form, where user can select
I have following code in a html form <select name=category class=input onchange=ShowTB(this,'suggest');> <option value=0
I have the following html code: <form> <table> <tbody> <tr> <td> <span>Quantity<span class=pull-right>3</span> <input
I have an HTML form using dojo and have the following code for a
I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
I have a html/php form like the following: Form 1: Apple options: -big -medium
I have a following problem, I have HTML form that uploads a file with
I have a simple html form that looks like the following <form action=search.php method=get>
I have following Situation, Server A sends some data (HTML form) to server B,
I have the following form: @model Teesa.Models.SearchModel @using (Html.BeginForm(Index, Search, FormMethod.Get, new { id

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.