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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:38:34+00:00 2026-06-16T02:38:34+00:00

I have an HTML page that has a form in it. The form then

  • 0

I have an HTML page that has a form in it. The form then posts to a PHP page where it sends out an email to the user. I have a ‘State’ dropdown box with values of 1-58(I need these for my database). Is there a way to get the name of the state instead of the number value when sending the email?

My HTML:

<Select name="State" id="State" style="width:40px;" >
  <option value="17"></option>
  <option value="18">Alabama</option>
  <option value="19">Alaska</option>
  <option value="20">American Samoa</option>
  <option value="21">Arizona</option>
  <option value="22">Arkansas</option>
  <option value="15">California</option>
  <option value="6">Canada</option>
  <option value="11">Colorado</option>
  <option value="23">Connecticut</option>
  <option value="24">Delaware</option>
  <option value="25">District Of Columbia</option>
  <option value="26">Federated States Of Micronesia</option>
  <option value="7">Florida</option>
  <option value="27">Georgia</option>
  <option value="28">Guam</option>
  <option value="29">Hawaii</option>
  <option value="30">Idaho</option>
  <option value="8">Illinois</option>
  <option value="14">Indiana</option>
  <option value="31">Iowa</option>
  <option value="32">Kansas</option>
  <option value="33">Kentucky</option>
  <option value="34">Louisiana</option>
  <option value="35">Maine</option>
  <option value="36">Marshall Islands</option>
  <option value="37">Maryland</option>
  <option value="38">Massachusetts</option>
  <option value="1">Michigan</option>
  <option value="5">Minnesota</option>
  <option value="39">Mississippi</option>
  <option value="40">Missouri</option>
  <option value="41">Montana</option>
  <option value="42">Nebraska</option>
  <option value="43">Nevada</option>
  <option value="44">New Hampshire</option>
  <option value="12">New Jersey</option>
  <option value="45">New Mexico</option>
  <option value="46">New York</option>
  <option value="13">North Carolina</option>
  <option value="47">North Dakota</option>
  <option value="4">Ohio</option>
  <option value="48">Oklahoma</option>
  <option value="49">Oregon</option>
  <option value="10">Pennsylvania</option>
  <option value="50">Rhode Island</option>
  <option value="51">South Carolina</option>
  <option value="52">South Dakota</option>
  <option value="53">Tennessee</option>
  <option value="2">Texas</option>
  <option value="54">Utah</option>
  <option value="55">Vermont</option>
  <option value="3">Virginia</option>
  <option value="56">Washington</option>
  <option value="57">West Virginia</option>
  <option value="9">Wisconsin</option>
  <option value="58">Wyoming</option>
</Select>

Current PHP $message line:

 "\nState: " . stripslashes($_POST["State"]) . 

The emails I’m receiving are saying "State: 1" instead of "State: Michigan".

Thanks.

  • 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-16T02:38:35+00:00Added an answer on June 16, 2026 at 2:38 am

    Have an array control all the values. Use this same array to show the drop down option, then use the same array to reference the value.

    <?php
    //Place state array at the top of the file
    $states = array(
      18 => "Alabama",
      19 => "Alaska",
      ...
    );
    
    //Generate select box
    if(is_array($states)) {
      echo "<select name='state' id='state' style='width:40px'>";
      foreach($states as $id => $name) {
        echo "<option value='$id'>$name</option>";
      }
      echo "</select>";
    }
    
    //Form POSTed
    if(is_array($_POST)) {
      //Send email message
      $email = "State: ".$states[$_POST['state']];
      //Do email sending or message displaying
    
      //Submit to datebase
      $query = "INSERT INTO table ('state') VALUES ('".mysqli_escape_string($_POST['state'])."')";
      //Do insert into mysql
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that I need to design in PhP/Html/Java/CSS that has to
I have a php page that has a few HTML questions on it, each
This is bugging me ... I have a simple HTML page that has a
I have a html page that looks like: <html> .. <form post=/products.hmlt ..> ..
My dilemma is this: I have a PHP page with a form that includes
http://blog.helpcurenow.org/test/mockups/mar2010/lp.html In the above landing page, I have an offers box that has four
I have a html page that allows users to submit a file. Below is
I have an html page that open a popup window when the page loads.
I have an HTML page that contains some filenames that i want to download
I have an HTML page that roughly looks like this: <div id=rolesRollerBody style=height: 309px;>

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.