If i removes error_reporting(0) function it gives error " undefined index tm ".can any one have solution sothat i can use this script without this function.

<?php
require '../zones/publisher_header.php';
?>
<Script language="JavaScript">

function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}
//-->
</SCRIPT>

<h2 style="padding:25px;border:1px solid red; width:90%;">Publisher Dashboard</h2>


<FORM NAME="form1" class="tm">
<SELECT NAME="select" ONCHANGE="goto(this.form)" SIZE="1">
<OPTION <?php
error_reporting(0);
if($_GET['tm']==td)
{
    echo "SELECTED=SELECTED";
}
?> VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=td" >Today
<OPTION <?php
error_reporting(0);
if($_GET['tm']==ys)
{
    echo "SELECTED=SELECTED";
}
?> VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=ys" >Yesterday
<OPTION <?php
error_reporting(0);
if($_GET['tm']==lw)
{
    echo "SELECTED=SELECTED";
}
?> VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=lw" >Last 7 days
<OPTION <?php
error_reporting(0);
if($_GET['tm']==tm)
{
    echo "SELECTED=SELECTED";
}
?> VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=tm" >Last 30 days
<OPTION <?php
error_reporting(0);
if($_GET['tm']==cm)
{
    echo "SELECTED=SELECTED";
}
?>VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=cm" >This month
<OPTION <?php
error_reporting(0);
if($_GET['tm']==lm)
{
    echo "SELECTED=SELECTED";
}
?> VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=lm" >Last month
<OPTION <?php
error_reporting(0);
if($_GET['tm']==at)
{
    echo "SELECTED=SELECTED";
}
?> VALUE="http://localhost/adbrite/zones/publisher_dashboard.php?tm=at" >All time
</SELECT>
</FORM>
<h5 style="padding:25px;border:1px solid red;"><?php 
error_reporting(0);
switch($_GET['tm']) 
    {
        case td:
        echo "today";
        break;
        case ys:
        echo "yesterday";
        break;
        case lw:
        echo "last 7 days";
        break;
        case tm:
        echo "last 30 days";
        break;
        case cm:
        echo " this month";
        break;
        case lm:
        echo "last month";
        break;
        case at:
        echo "all time";
        break;
        default:
        echo "today";
    }?> Earning</h5>
    <table border="1" width="90%" class="tbl">
    <tr>
    <td colspan="2">Ad zone views</td>
    <td>clicks</td>
    <td>Ad revenue</td>
    </tr>
    <tr>
    <td colspan="2">30</td>
    <td>16</td>
    <td>$.46</td>
    </tr>
    </table>
    <table width="90%" class="tbl2">
    <tr>
    <td>Average daily earnings   $0.02</td>
    <td>Yesterday’s pageviews    3</td>
    <td>Month-to-date earnings   $0.49</td>
    </tr>
    <tr>
    <td>past 30 days</td>
    <td>Average daily pageviews  1</td>
    <td>April earnings:  $0.00</td>
    </tr>
    <tr>
    <td></td>
    <td>past 30 days</td>
    <td>March earnings   $0.00</td>
    </tr>
    </table>

Wherever you are using $_GET'tm'] use isset($_GET['tm'])before it as shown below

if(isset($_GET['tm']) && $_GET['tm']...something..)

Now It is giving error undefined constant td.

$_GET['tm']==td

td should be in quote. i.e. 'td' OR "td"

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.