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.

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

UPLOAD IMAGES NOT WORKING!
Hi there i have a upload script in which it uploads the picture to a folder than creates two thumbna

Remore client postprocessing phase getting dump SAPSQL_ARRAY_INSERT_DUPREC
Hello Expects,I have started remore client copy. Data was copied successfully. but while running pos

Check premium expire
Hi,

I am making a simple file hosting site and want to check if users premium subscriptions h

Table control is disappearing from Screen
Hi Experts,

I have a screen with multiple table control(TC). Each table control has two c

need help to creat database
Hello Team, please guys i am stuck from three days with paypal issue for IPN but no luck yet now i w

I face problems to extract data from one table and insert it in another one
Hi,

For modifications, I have to extract data from one table and insert it in another one

that old Malformed Headers problem again!!!!! HELP!!!!!!
I've read the http://www.phpfreaks.com/forums/index.php/topic,37442.0.html

I don't think my c

Help with setcookie()
Merry Xmas to those on this foruum
Older guy here with some experience but not allot so please be

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page

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