EXplanation help


Posted on 16th Feb 2014 07:03 pm by admin

Hey all,

I am still fairly new to PHP programming and I am trying to put together a page where you select search terms from a drop down menu and it keeps the menu at your search choice in the menu after the search.

Did you know?Explore Trending and Topic pages for more stories like this.
Here is the code I was suggested to use, but I am having problems understanding how it keeps the choice in the menu.

I can almost understand how it works, but I need a little push to grasp it.

Here is the code:

foreach($options as $key => $content)
{
if ($key == $value) $select = ' selected="selected"';
else $select = NULL;
$html .=
'<option value="' . htmlspecialchars($key) . '"' . $select .
'>' . htmlspecialchars($content) . '</option>' . "n";
}

Now I understand how to walk through the code, but I am having trouble understanding how it holds over the choice.

THanks in advance for the help...
No comments posted yet

Your Answer:

Login to answer
195 Like 47 Dislike
Previous forums Next forums
Other forums

Custom list order
Hi there,

I have checked this tutorial and it's great till the point where I want to display

progress bar...need expert opinion of experienced webmaster
Hey guys, quick question:

I want to display a progress bar when I upload files, but I am not

Material xxx does not exist in plant xxx
Dear All,

I am working for a steel project which is repetitive manufacturing.

turning an array into a string then poping it into a db
Hi im just wondering how you get a requested array into a single string then pop it into the db so f

PHP MySQL Return Results Issue
Hi guys,

I'm running joomla and made a module which is using ajax.
Basically i just have a

How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignor

modifying a property of an object from a different class
I have 2 classes:
- Math
- Distance

in my math class, I have this line:
$distance =

Unable to display contents in Second Drop Down Box
Hi All,

What I am trying to do is 2 dependent drop down boxes and when user selects su

CHMOD script
Hi,

I need a script to read all files in a folder and set to 777.

Can anyone help out

While Problem
i am having a problem with a while statement here is the code
Code: [Select]<?php
sess

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash