Jump to content

how to give link to variable


Bala

Recommended Posts

The following are the program how can i give pass variable to href

 

<?php

// search.php

$dd=$_POST[days];

$dd = str_pad($dd, 2, '0', 1); // If it is less than 2 characters long, add a 0 on the left side

$mm=$_POST[month];

$mm = str_pad($mm, 2, '0', 1); // If it is less than 2 characters long, add a 0 on the left side

$yy=$_POST[year];

$j=$dd . "-" . $mm . "-" . $yy . ".html";

echo "<a href=<?$def_dir/$j?>clickhere</a>";

$month = strtolower(date('M', strtotime("$yy$mm$dd 12:00:00"))); // A lot going on here

// strtolower makes the results all lowercase to match your 'mar' for march

// date('M', ...) returns the 3-letter form of month

// strtotime() is returning the unix timestamp for date() for the submitted date, at 12 noon.

$def_dir="/var/www/html/backup/$month";

?>

Link to comment
https://forums.phpfreaks.com/topic/98654-how-to-give-link-to-variable/
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.