Jump to content

Setting form variable outside form


sazzie

Recommended Posts

Hi guys,

I have a form defined below:

[code]
<form method="post" action=" <?php echo $_SERVER["PHP_SELF"];?> ">
<select name="month" >
<?php
$months = Array("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");
for( $x = 1; $x <= count($months); $x++ )
{
      echo "<option value=\"$x\"";
      if( $x == $month )
      {
echo "selected";
$m = $month;
        }
        echo ">".$months[$x-1]."</option>";
}
?>
</select>
</form>
[/code]

All I want to do is to be able to use a seperate hyperlinked image on my webpage to scroll through the months in my array. So in addition to being able to select any month in my dropdown list, I want an arrow to scroll through one month per click. ???
I figure that means begin able to set the value of month, possibly as a post variable(don't know if its even possible), outside of the form and refreshing the page.

I have never done anything like this before. Can anyone offer and insight into this?

Thanks  ;)
Link to comment
https://forums.phpfreaks.com/topic/36302-setting-form-variable-outside-form/
Share on other sites

I am sure i'm missing something but I don't see how using get instead of post will help influence the value of my drop down list.

I need a way to change the value of month without using the list. This is so I can scroll through my months as well as select from the list.

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.