Forum Moderators: coopster
Array Sample
property, value,
(
audio, 0,
audio, 1,
audio, 2,
bandwidth, 1,
bandwidth, 2,
browserpatch, 0,
browserpatch, 1,
dhtmleffects, 0,
dhtmleffects, 1,
dhtmlengine, 0,
dhtmlengine, 1,
dtd, t,
dtd, s,
dtd, 1,
dtd, 2,
mediatype, xx,
mediatype, ax,
mediatype, tx,
mediatype, th,
ieccss, 0,
ieccss, 1,
powerkeys, 0,
powerkeys, 1,
theme, classic,
theme, cityblue,
theme, emerald,
theme, lavender,
)
These are examples of my working properties and values. If I could keep the list like it is right now with minor modifications to get it working it would be great as I plan on adding further options in the future. However I'm not exactly sure how I should approach this.
Also this is important as I have tested invalid values and it broke the page once while being served as application/xhtml+xml so this could potentially lead to loosing visitors if I do not address this issue. Suggestions to create this error handler script?
- John
[edited by: JAB_Creations at 3:40 am (utc) on April 26, 2007]
<a href="index.php?audio=1">test</a>
If someone enters an invalid value for a property (or an invalid property) I want to be able to capture it in a sense and display a help layer to make the user aware with links to references.
- John
[edited by: JAB_Creations at 7:13 am (utc) on April 26, 2007]
Does the code below suits your needs
$Properties = array(
'audio' => array(0,1,2),
'bandwidth' => array(1,2),
...
'theme' => array('classic','cityblue','emerald','lavender')
);
foreach($_GET as $property => $value)
{
if (array_key_exists($property,$Properties))
{
if (array_search($value,$Properties[$property]) === FALSE)
{
echo "Invalid value $value for property $property\n";
}
else
{
/* here you may handle the property with a valid value */
}
}
else
{
echo "Invalid property $property\n";
}
}
BTW, I haven't tested the code above
Regards,
Arjan