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

Members Only
Hi all, for my website i have a members area only which on members can veiw, but at the moment anyon

Access database inside of a validation class
Hello,

For quite some time, I have been using functions to validate form input and access the

What makes a script your own?
If someone finds a login script online, and changes some variable names around and some other minor

PHP Script runs on CLI but not through web browser
I am running into an issue that I just can't seem to find the answer to. I have a Windows Server 200

User input in to variable
Hi all,

I'm sure this is very easy but I'm having another brain freeze!

At the end of

Blank record injected into database
I always found several blank records inside my database, although $SESSION is required to insert the

help, header() is not working!
Hello, I have this code:


<?php

/**
* @author samoi
* @copyright 200

Breaking results into week blocks
I have a set of dates (and times), which are returned from a mySQL query.

These usually span

Php - mysql select?
hi, i have this code:

Code: <?php
session_start();
// dBase file
include &quo

The repetition structure: the while statement not working
New programming student, have assignment as follows:
A restaurant has 4 lunch combos for custom

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