Hi,
I’m working on a personal project where I have 13 radio buttons that represent this month and the next twelve months. I use JQuery to generate the month and year based on the radio button index (or offset). No problem I use this info to construct a file name, e.g., 2010_3.txt. I need to get that name into php to read/write the file. I could generate the file name in php if I could get the offset into php. I have spent 2 days on this problem and still come up blank although I’ve read everything I can find. Using _GET to obtain the variable (in another file) showed promise, but I was unable to get a variable value to pass unless it was specifically assigned on the previous page. Something like …/process.php?filedate=2010_4.txt works great, but is worthless unless the user clicked on April. I don’t know how to pass the constructed file name (or month offset) to php. Any and all help will be appreciated.
<input type="radio" name="months" value="0">
<input type="radio" name="months" value="1">
...etc...
$additional_months = (int) $_POST['months'];
$timestamp = strtotime("now + $additional_months months");
Now you can use date() to create the filename. Make sure to validate the value is between 0 to 12 inclusive.
Tried your solution and it worked perfectly. For trial I posted to a page that echoed the additional months value, 0-12. It worked like a charm. Thanks!!