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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:51:08+00:00 2026-05-26T19:51:08+00:00

Please bear with me, my apologies if this post is too long… I’m attempting

  • 0

Please bear with me, my apologies if this post is too long…

I’m attempting to build a custom advanced search form within Magento. Basically, I have a bunch of select boxes and the selected values correspond with my Magento product attribute values and append to the URL, so if you had a selection box like this:

<select name="diameterange" id="diameterange">

      <option value=''<?php echo $_SESSION['post']['diameterange']=='all'?'selected="selected"':''; ?>>all</option>
      <option value='15'<?php echo $_SESSION['post']['diameterange']=='15'?'selected="selected"':''; ?>>Small</option>
      <option value='14'<?php echo $_SESSION['post']['diameterange']=='14'?'selected="selected"':''; ?>>Medium</option>
      <option value='13'<?php echo $_SESSION['post']['diameterange']=='13'?'selected="selected"':''; ?>>Large</option>

And you chose “Small”, the URL would result in:

http://mymagento.com/catalogsearch/advancedsearch/result/?diameterange=15

You can see I’m echoing the values so that when the results page is loaded, the user sees the same search form with their selections pre-selected, above their new search results. This all works fine and dandy except for one attribute in particular – price[from].

Here is the code for my price[from] selection box:

<select name="price[from]" id="price[from]">

      <option value=''<?php echo $_SESSION['post']['price[from]']==''?'selected="selected"':''; ?>>from (all)</option>

      <option value='100'<?php echo $_SESSION['post']['price[from]']=='100'?'selected="selected"':''; ?>>from $100</option>

      <option value='200'<?php echo $_SESSION['post']['price[from]']=='200'?'selected="selected"':''; ?>>from $200</option>

      <option value='300'<?php echo $_SESSION['post']['price[from]']=='300'?'selected="selected"':''; ?>>from $300</option>

      <option value='400'<?php echo $_SESSION['post']['price[from]']=='400'?'selected="selected"':''; ?>>from $400</option>

      <option value='500'<?php echo $_SESSION['post']['price[from]']=='500'?'selected="selected"':''; ?>>from $500</option>

      <option value='600'<?php echo $_SESSION['post']['price[from]']=='600'?'selected="selected"':''; ?>>from $600</option>

      <option value='700'<?php echo $_SESSION['post']['price[from]']=='700'?'selected="selected"':''; ?>>from $700+</option>

  </select>

This box and its selected value works correctly as far as the URL appending goes, and it will bring you the correct results, but I cannot get this selection box to remember its value like I can with the other attributes. So if a user has chosen a value in this box, his choice isn’t pre-selected on the search form on the search results page.

I’m convinced this has something to do with the [ ] brackets in the select box’s name and ID. How can I echo the selected choice for this particular box?

Thank you

  • 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-26T19:51:09+00:00Added an answer on May 26, 2026 at 7:51 pm

    It should be probably be

    $_SESSION['post']['price']['from']
    

    instead. You can verify by doing a var_dump($_SESSION['post']).

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

Sidebar

Related Questions

This is my first post on StackOverflow, so please bear with me. And I
Please bear with me if this question isn't well formulated. Not knowing is part
I am new to bash so please bear with me if this is a
Please bear with me as I've been thrown into the middle of this project
This is kinda confusing so please bear with me. I have an array (listOfStates)
Please bear with me Silverlight Designer Gurus, this is compicated (to me). I'm creating
I'm a fairly new programmer so please bear with me on this. I am
I'm kind of new to this so please bear with me... Let's say I
NOTICE This is a rather large question, so please bear with me and I
Please bear with me on this as I'm still getting the hang on Java.

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.