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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:33:07+00:00 2026-06-18T16:33:07+00:00

First see my code. <select multiple name=’assign_to[]’> <? $result_10 = mysql_query(select * from login_users)

  • 0

First see my code.

   <select multiple name='assign_to[]'>
                    <?
                $result_10 = mysql_query("select * from login_users") or die(mysql_error());
                while($row_10 = mysql_fetch_object($result_10))
                {
                    echo "<option  value=".$row_10->user_id.">".$row_10->username."</option>";
                }
                ?>
    </select>

I am able to get value when page is submitted no issue with this but my problem is :

When page is submitted I am redirecting to the same page then I want that options which are selected before submitting the form will seen selected after page is submitted.

What PHP code is to written there. What I did for single selected drop down as :

<?
while($row_10 = mysql_fetch_object($result_10))
                    {
?>
       <option <?=$row_10->user_id==$_POST['assign_to']?'selected':''?> value="<?=$row_10->user_id?>"><?=$row_10->username?></option>
<?
                    }

?>

Hope you are getting my question ?

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-18T16:33:08+00:00Added an answer on June 18, 2026 at 4:33 pm
    if(in_array($row_10->user_id,$_POST['assign_to'])){echo "selected"}else{echo ""}
    

    As your $_POST[‘assign_to’] is an array i guess this will work.

    OR you can use conditional operators :

    <option <?= in_array($row_10->user_id,$_POST['assign_to']) ? 'selected' : ''?> value="<?=$row_10->user_id?>"><?=$row_10->username?></option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First see my Source Code: WebClient client = new WebClient(); String url = http://localhost;
Please see below code: thrust::device_vector<int>::iterator whereToBegin = copyListOfNgramCounteachdoc.begin(); end = thrust::unique_by_key(end.first, end.first + numUniqueNgrams,end.second);
this code/markup in conjunction with a php script renders a multiple select input populated
I wanna check sharepoint title first and see if the lib doesn't have that
I have a .txt file with content(see first image) I need the content in
It is not the first time i see it Ive seen in Facebook source
I'm just taking my first steps with Azure and the first thing I see
I'm familiarizing myself with Ruby and it's the first time I see synonyms for
Please see following examples first, and which one is better? Could you compare some
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport

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.