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

MYSQL gen help
This is my Mysql gen. can anyone tell me why this echos

MID(networkset.networkid, 3, 3) AS &q

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

Random date selection
i want to select random date with time(hour+minutes+sec) where date is specified(10/22/2009) and tim

PEAR in appliactiond development
When I was picking up PHP I went from procedural programming, fairly quickly into OOP, then after wr

check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it

Stuck with preg_replace
Hi,

I'm trying to use preg_replace to remove part of the IP address submitted using a form on

big pagination problem in php
<?php

$connect = mysql_connect("localhost", "root", "")

OPINIONS WANTED
This is my login page code, and I want your opinion on it please!

Code: // Login ~ CHECKS

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