mardi 1 septembre 2015

If isset statement not bringing up an input field

I have the following code where I am trying to get the 'Finalize Draft Order' submit button to only appear if the 'Create Draft Order' button has been pressed/set. Right now, the button does not show up after I hit the Create Draft Order button. It only displays if I take it out of the if(isset function.

What am I doing wrong?

<form method="POST" name="form">
<input type="submit" value="Create Draft Order" name="shuffle">
</form>

    Shuffled results: <br>
    <div class="main-bag">     
    <div class="shuffle_results" id="results"></div>
     <form method="post">
<?php
$count = 0;
    foreach ($array as $result) :
    $count++;
    $shuffle_count = $count;
        $shuffle_firstname = htmlentities($result['firstname']);
        $shuffle_lastname = htmlentities($result['lastname']);
        $shuffle_id = htmlentities($result['id']);
        $shuffle_username = htmlentities($result['username']);
        $shuffle_email = htmlentities($result['email']);
?>
    <input type="hidden" name="count[]" value="<?php echo $shuffle_count; ?>">
        <input type="hidden" name="firstname[]" value="<?php echo $shuffle_firstname; ?>">
        <input type="hidden" name="lastname[]" value="<?php echo $shuffle_lastname; ?>">
        <input type="hidden" name="id[]" value="<?php echo $shuffle_id; ?>">
        <input type="hidden" name="username[]" value="<?php echo $shuffle_username; ?>">
        <input type="hidden" name="email[]" value="<?php echo $shuffle_email; ?>">

<?php 

    endforeach;
    // only show this button if we have done a shuffle
     if ( isset($_POST['shuffle'] ) ) :
        echo '<input type="submit" value="Finalize Draft Order" name="insert">';
    endif;

?>

Aucun commentaire:

Enregistrer un commentaire