• Hi

    I have a template file that show this:

    [lottery title="" state="CA" style="balls" games="0,1,2,3,4,5,6,7" link=false]

    It works beautifully. The problem is that it defaults always to California. I want to modify this code above by allowing viewers to choose their state and then display the results for the state they chose.

    I added this code:

    [please remember to mark any posted code; the code below is partially broken; http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

    <?php
    $Mstate="CA";
    ?>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
      <tr>
        <td width="50%" valign="top">
    <b>Pick Your State:</b>
    <?php
    $states=array("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington",
    "West Virginia","Wisconsin","Wyoming");
    $arrlength=count($states);
    for($x=0;$x<$arrlength;$x++)
      {
      echo '<a href="">' . $states[$x] . '</a>';
      echo "";
      }
    ?>
        </td>
        <td width="2%"> </td>
        <td width="48%" valign="top">
    [lottery title="" state="<?php echo $Mstate; ?>" style="balls" games="0,1,2,3,4,5,6,7" link=false]
        </td>
      </tr>
    </table>

    This code lists all fifty states as a clickable link but when I click on the link, nothing happens and $Mstate doesn’t get updated with the
    proper abbreviation for the state.

    Any suggestions?

    thanks

  • The topic ‘How Do I Modify This Template Correctly?’ is closed to new replies.