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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:04:18+00:00 2026-06-13T03:04:18+00:00

i have a dropdown list of countries.. the html code is as below: <select>

  • 0

i have a dropdown list of countries.. the html code is as below:

<select>
<option value=”Singapore“>Singapore</option>
</select>

This html code resides in a php page, which then sends the form and stores the value from the dropdown into mysql db.

Before I send it to db, within php I do a small data sanitization as below:

$post_tag2 = mysqli_real_escape_string($db_conn, $post_tag2);
$post_tag2 = preg_replace('/\s+/', '', $post_tag2);
$post_tag2 = strtolower($post_tag2);

where post_tag2 has the value from the dropdown list. i basically convert it into lowercase and remove all the spaces and then store it into my db.

But the result of all this, when the data gets saved into db is like this:

â€singapore“

And if the dropdown value is burkina faso, then in db it is: â€burkina
(basically the word after the space is gone, and then there is that extra symbol before Burkina)

how do i make sure that these extra symbols †do not come? Also, why is it cutting off the word after the space?

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-13T03:04:22+00:00Added an answer on June 13, 2026 at 3:04 am

    You are using the wrong type of quotes, ”and “ will be interpreted as content. Consequently a space would indicate the end of the attribute value since there are no proper delimiters.

    You’ll have to use either ' or ":

    <option value="Singapore">Singapore</option>
    <option value='Singapore'>Singapore</option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this drop-down list of countries: <select name=country> <option value=>Country...</option> <option value=Afganistan>Afghanistan</option> <option
I have the following dropdown list: <select id=dropdown> <option value=AB>Alberta Standards</option> <option value=BC>British Columbia
I have this code to set the default value of my select list: public
On my page I have a dropdown menu with a list of countries, this
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
I have multiple dropdown list: @Html.DropDownListFor(x => x.HaveColoSpace.SelectedOptions, new SelectList(Model.HaveColoSpace.Options, Value, Text), new {
I have the dropdown list like this <?php echo $form->dropdownList($customers,'customer_name', CHtml::listData(Customers::model()->findAll(), 'id', 'customer_name'), array(
I have a dropdown say list of countries, and below that I have a
I want to use php array for HTML select list. In this case it
I have a dropdown list. I am using onchange event of this dropdown to

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.