Howdy! I've racked my brain over this for 24 hours now. I think it's time I asked for help. I'm learning PHP and believe my I've manipulated many code blocks trying to get this to work with for and foreach and while statements. There must be something I'm missing in my studies about arrays but anyway here is the issue.
I have a multidimensional array. From that array I would like to extract only the values of a specific key['name'] so that I can then output it into html form with a special identifier. I was able to do this with nested if statements but that seemed a bit overkill to me.
Here is the code I came up. I know there has to be a more efficient way of getting these results.
Here is the Array code:
Code: $options = array(
array( "name" => "General Administrative Settings",
"type" => "title"),
array( "type" => "open"),
array( "name" => "Colour Scheme",
"desc" => "Which colour scheme would you like?",
"id" => $shortname."_colourscheme",
"type" => "select",
"std" => "Choose a colour scheme:",
"options" => $styles),
array( "name" => "Portfolio Category",
"desc" => "Select the category portfolio items are being posted in.",
"id" => $shortname. "_portfolio_cat",
"type" => "select",
"std" => "Choose a category:",
"options" => $getcat),
array( "name" => "Definition List",
"desc" => "Select the page used as a definition list page.",
"id" => $shortname."_definition_list",
"type" => "select",
"std" => "Select a page:",
"options" => $getpag),
array( "name" => "Blog page",
"desc" => "Select the page to be used as a blog (post) page.",
"id" => $shortname."_blogpage",
"type" => "select",
"std" => "Select a page:",
"options" => $getpag),
array( "type" => "close")
);
Here is my output code:
Code: <?php
if($options['name'] = "Colour Scheme"){
echo '<div id="col_schm">Colour Scheme</div>';
if($options['name'] = "Definition List") {
echo '<div id="def_lst">Definition List</div>';
}
}
?>
If you can help I would appreciate it.
Thanks
php/mysql auto logout after 2 hour and reset password
Hi all, This I hope will make sense. I've the following code which when a user logins in, creates a session: if (isset($_POST['submitted'])) { // Check if the form has been submitted. require_once
how to transport the Query and insfoset
Hi
Transform value 0 in no and 1 in yes help needed
Hello,I have this in the table: "value" type int 0 to represent false and 1 to represent true. everything works great in display to the user end it sees 0 or 1 i want to replace the 0 to
Batch update record with Pagination
Hoping someone can help me with this issue I'm having, im trying to batch update records from a result set with pagination. The first page results (first 10 records) will update with the batch, but
Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.But, I'm stuck - the file isn't downloading, and no error is being shown (I've enabled E_ALL error
Include ("Absolute Path") of a file?
I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that I wish to include is in. So, here's what I have written:Code: include ('file.php');This works
New to PHP and just trying to understand a little code.
I hope I'm not annoying anyone or breaking the rules but I was wondering about this bit of code right here: " <?php$people = Array(Array('name' => 'Kalle', 'salt' =>
IP question
ive got 2 ip addresses both global from same user how would i detect if they are local to each other
phpmailer class & pop.gmail.com?
Code: <?php $mail->IsSMTP();$mail->Host = "pop.gmail.com";$mail->Port = 995;$mail->SMTPAuth = true;$mail->Username =
classic dynpro : hide area and auto adjust hights
Hi,