Hi ,

I have named my databases as Week1Jan2012 for 1st week of January ,
(1-7 Jan 2012)

Is there any way to map Week1Jan2012 to 1-7 Jan2012 ,So that I can make a drop down to select this mapped once so that it selects from Week1Jan2012 database.

Thanks

You can do something like in the following code

<?php
    $comboText = "1-7 Jan 2012";

    // Categorizing the weeks
    $weeks = array('1-7', '8-14', '15-21', '22-28', '29-31');

    $comboTextArray = explode(' ',$comboText);
    $weekNumber = array_search($comboTextArray[0], $weeks);

    if($weekNumber >= 0)
    {
        echo "Week".($weekNumber+1).$comboTextArray[1].$comboTextArray[2];
    }
?>

$comboText must be replaced from the string you get from the combo box each time

Hope I understood your question correctly :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.