jeudi 26 novembre 2015

php if else via HTMLselect form

I attempted to search pretty thoroughly prior to asking this question (very few questions had any back story so I'm unsure if they fit or no). I am attempting to add a select field to a form in which an "if, else" function will result in a line of code being echoed IF the parameter is "yes". For the HTML, the config is as follows:

    <select name="pim">
      <option value="pim_enabled">Yes</option>
      <option value="pim_disabled">No</option>
    </select>

On my resulting configuration page, I am attempting to reference the option values and provided pim enabled is selected, additional lines of code will be echoed in which a value from a former field (TenGigED/D/D/D) will be echoed as well. My current configuration here is as such:

<?php if ($_POST["pim_enabled"]) { 
 echo 
 "Router PIM"
 echo $_POST["TenGigEC/C/C/C"];
 } else {
 echo
 "Final Config" 
 }

 ?>

I'm relatively new to this process, but I feel some degree of certainty that I'm off base with my if/else statement. Hopefully you guys can show me the error of my ways and I can build from the lesson learned.

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire