Jump to content

php_self help


nezbo

Recommended Posts

Hi all

 

I have a question about the $_server['php_self'] class,

 

i am using quite a lot of extention to my links, and i want them to be included in my $_server['php_self']...

 

i.e.

 

i have a link

 

www.mysite.co.uk/index.php?this=what i want to pass

 

i hope this is posible, or is there a better way to pass comands from page to page?

 

 

Link to comment
https://forums.phpfreaks.com/topic/86127-php_self-help/
Share on other sites

ok sorry i am prity new to programming and i am not to sure the difrence between most things.

 

but what i am trying to do is this ::

 

i have a calinder that i can select the date from and then use the info. but if i select the next month i use the link to store the muiliplyer, i.e. 1 day, 7 days or 1 month using a << and >> as the links. then each one of the days uses a link that i want to pass the php_self and also keep the original part in the year...

 

the intention is to do an include("cal.php"); on a page that also uses (i am not to sure what they are called) var in the link. (the ?mon=*** bit)

 

i hope this makes more sence

 

here is the code ::

 

<?php
//Edit the below three lines to change the colors (Look and Feel of the calander). 
$bgcolor="#6ec6f1";
$tablecolor = "#666645";
$fontcolor = "#E3F70A";
$tableborder = "#6ec6f1";

//Don't edit any lines shown below
//$today = getdate();
$today = mktime();

if ($_REQUEST['mon'])
{

$today = $today + 24 * 60 * 60 * $_REQUEST['mon'];
$mon = date("m", $today); //month
$monnn = date("F", $today);
$year = date("Y", $today); //this year
$day = date("d", $today);
}
else
{
$mon = date("m", $today); //month
$monnn = date("F", $today);
$year = date("Y", $today); //this year
$day = date("d", $today);
}

$day1 = $day-1;

$my_time= mktime(0,0,0,$mon,1,$year);
$start_mon = date('d', $my_time); //Month starting date
$start_day = date('D', $my_time); //Month starting Day
$start_daynum = date('w', $my_time);

$daysIM = DayInMonth($mon,$year); //Number of days in this month

function DayInMonth($month, $year)
{
   $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
   if ($month != 2)
   {
    	return $daysInMonth[$month - 1];
    }
    else
    {
   	return (checkdate($month, 29, $year)) ? 29 : 28;
    }
}
?>

<table width=250 height=150 bgcolor= <?php echo $bgcolor; ?> cellpadding=1 style="border:1px solid #000000; " color=<?php echo $tableborder; ?> >
<tr>
<td width=220 align=center style="border-bottom:0px solid #ffffff">
<?php 

$countMonthsNegMonth = $_REQUEST['mon'] - $daysIM;	
echo "<a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $countMonthsNegMonth . " ><<<</a>";
echo " ";
$countMonthsNegWeek = $_REQUEST['mon'] - 7;
echo "<a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $countMonthsNegWeek . " ><<</a>";
echo " ";
$countMonthsNeg = $_REQUEST['mon'] - 1;	
echo "<a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $countMonthsNeg . " ><</a>";
echo " ";

?>
</td>
<td width=300 align="center" style="border-bottom: 0px solid #ffffff">
<?php
echo "<b>";
echo $monnn;
echo " , ";
echo $year;
echo "</b></font>";
  ?>
</td>
<td width=220 style="border-bottom: 0px solid #ffffff">
<?php 
$countMonthsPos = $_REQUEST['mon'] + 1;
echo "<a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $countMonthsPos . " >></a>";
echo " ";
$countMonthsPosWeek = $_REQUEST['mon'] + 7;
echo "<a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $countMonthsPosWeek . " >>></a>";
echo " ";
$countMonthsNegMonth = $_REQUEST['mon'] + $daysIM;
echo "<a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $countMonthsNegMonth . " >>>></a>";
?>
<!-- <a href="<?php //$_SERVER['PHP_SELF'] ?>" > test </a> -->
</td>
</tr>
<tr>
<td colspan=3 align="center">
<a href="<?php $_SERVER['PHP_SELF'] ?>">Today</a>
</td></tr>

<tr width=250 height=100>
<td width=250 height=100 colspan=3>
<table width=250 height=100 border=0 bgcolor= <?php echo $bgcolor; ?> cellpadding=0 cellspacing=1 border=0 color=<?php echo $tableborder; ?> >
<tr bgcolor=#505050 align=center>
<td><font size=-1><b>Sun</b></font></td><td><font size=-1><b>Mon</b></font></td><td><font size=-1><b>Tue</b></font></td>
<td><font size=-1><b>Wed</b></font></td><td><font size=-1><b>Thu</b></font></td><td><font size=-1><b>Fri</b></font></td><td><font size=-1><b>Sat</b></font></td>
</tr>
<?php
$dd = 0;
$daye = 1;
echo "<tr bgcolor=$tablecolor>";
while($dd < $start_daynum)
{
echo  "<td></td>";
$dd = $dd+1;
}

while($dd < 7)
{
if($daye == $day)
{

	echo  "<td bgcolor=#001100 align=center><font size=-1 color=$fontcolor><b><a href=" . $_SERVER['PHP_SELF']. "?mon=" . $_REQUEST['mon'] . "&day=" . $daye . ">".$daye++."</a></b></font></td>";
	$dd++;
}
else
{
	echo  "<td align=center><font size=-1 color=$fontcolor><b><a href=" . $_SERVER['PHP_SELF']. "?mon=" . $_REQUEST['mon'] . "&day=" . $daye . ">".$daye++."</a></b></font></td>";
	$dd++;
}
}
echo "</tr>";

while($daye < $daysIM)
{
echo "<tr bgcolor=$tablecolor>";
$dd = 0;
while($dd<7)
{
if($daye <= $daysIM)
{
if($daye == $day)
{
	echo  "<td bgcolor=#001100 align=center><font size=-1 color=$fontcolor><b><a href=" . $_SERVER['PHP_SELF']. "?mon=" . $_REQUEST['mon'] . "&day=" . $daye . ">".$daye++."</a></b></font></td>";
	$dd++;
}
else
{
	echo  "<td align=center><font size=-1 color=$fontcolor><b><a href=" . $_SERVER['PHP_SELF'] . "?mon=" . $_REQUEST['mon'] . "&day=" . $daye . ">".$daye++."</a></b></font></td>";
	$dd++;
};
}
else
{
echo  "<td></td>";
$dd++;
}

}
echo "</tr>";
}


?>
</table>
</td>
</tr>

</table>

 

 

 

For starters, its $_SERVER['PHP_SELF']. The $_SERVER array (not class) is a global.

 

As for your question, you'll need to be alot clearer in your explination.

Link to comment
https://forums.phpfreaks.com/topic/86127-php_self-help/#findComment-439845
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.