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

Syntax Help
Code:


im having trouble with that code snipped
Parse error: syntax error, unexpec

foreach help.
Hello all,

First time I'm attempting to use a foreach statement and was just wondering if my

ORA-01017: invalid username/password; logon denied
Dear All,

I am facing problem in taken backup from db13 it comes up with the following l

problems with contact forms that are only protected against SQL injections
What could be a potential problem with contact forms that are only protected against SQL injections

Final year project, please point me in the right direction
hi there for my final year project I'm aiming to build a php script shell to use as an expert system

Object Interfaces
EDIT: Never mind, I just updated to php 5.

Hey all,

I'm currently experimenting with p

Array question
Does anyone know how to create a program that takes the $ amount for 8 different departments and gi

passthru() help
Hi everyone,
I'm new to the forum and to PHP. I have some pretty good experience writing shell sc

send() and recv() parameters confusion
On server Side:
int recv (Socket,Buffer, Length, Flags)
On Client Side:
int send (Soc

Simpler method of getting variables from mysql
Hi Guys,

I'm trying to streamline my CMS's code and as I was writing a new page it occured to

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