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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:16:03+00:00 2026-05-23T13:16:03+00:00

I am using a dropdown box to perform a selection in a form. I

  • 0

I am using a dropdown box to perform a selection in a form.

I have 4 values (‘value1′,’value2′,’value3′,’value4’). Each are listed in the dropdown box. But I also want an option for all 4 values for example, here is the array I am currently using for the function that draws my dropdown menu:

$menuValues("'value1','value2','value3','value4'",'value1','value2','value3','value4');

This however produces an empty variable on the action page. I need to retain the single quotes around each value to feed a function that in turn drives a mysql query. Which is why I have used double-quotes to enclose the first value.

This is the dropdown function:

function frDrop($arr,$frm,$dropTitle) {
echo "<select name='".$frm."' id='".$frm."'><option value=''>".$dropTitle."...</option>";
    foreach ($arr as $key => $value) {
    echo "<option value='".$value."'>".$value."</option>";
    }
echo "</select>";
}
  • 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-23T13:16:04+00:00Added an answer on May 23, 2026 at 1:16 pm

    It is not clear where is function frDrop() called and what does it’s argument mean. But for my answer below, I’m assuming that $arr is the array that contains the dropdown options. So,

    $arr = array(
    "'value1','value2','value3','value4'",
    'value1',
    'value2',
    'value3',
    'value4'
    );
    

    Now, as I’ve guessed in my comment above, perhaps the single-quotes in the first array value – “‘value1′,’value2′,’value3’,’value4′” – is conflicting with the single quotes in the tag in the foreach() in function frDrop(). This is how the tag will look like for the first value:

    <option value=''value1','value2','value3','value4''>'value1','value2','value3','value4'</option>
    

    You might try to escape the single quotes like this:

    echo "<option value='".addslashes($value)."'>".$value."</option>";
    

    OR, instead use single quotes to enclose your PHP statement:

    echo '<option value="' . $value . '">' . $value . '</option>';
    

    Hope this helps.

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

Sidebar

Related Questions

So I am using jQuery UI's dialog box. But as I have a read
I am using a dropdown to populate a textbox. But if preferred value is
How can I get the selected value of a dropdown box using jQuery? I
I have created one dropdown box <select name=select id=selectId> <option id= value=calendar_Second_Calendar_1285942672.xml>Second Calendar</option> <option
I m using a dropdown to display Location field of a table. I want
I've got a dropdown list that is being populated via a webservice using ASP>NET
Using jquery how do I focus the first element (edit field, text area, dropdown
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
I'm using the following chunks of code to populate a drop down box on

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.