php - POST array being deleted when page loads -



php - POST array being deleted when page loads -

i'm having issue guys, post info form page , next in relation code:

<?php /* * confirm registration page * */ $course = $_post['course_title']; $location = $_post['course_location']; $date = $_post['course_date']; $qty = $_post['attendlist']; $_post = array(); <------- need clear post array handler not called first time user on page. if (!empty($_post)){ $processorder = register_course_handler(); <--- handler } ?> <?php get_header(); ?> <?php while ( have_posts() ) : the_post(); ?> <!-- main container --> <div id="main_box"> <h1><?= $course . " " . $date ?></h1> <h2><?= $location ?></h2> <? the_content() ?> <!-- display form x amount of fields name, email, number --> <form action="#" method="post"> <table> <th></th> <th>name</th> <th>email</th> <th>phone</th> <? for($i = 0; $i < $qty; $i++):?> <tr><td>guest <?= $i + 1?></td> <td><input type="text" id="name" name="name"></td> <td><input type="text" id="email" name="email"/></td> <td><input type="text" id="phone" name="phone"/></td> <input type="hidden" name="course_id" value="<?= the_id() ?>"/> <input type="hidden" name="course_title" value="<?= the_title() ?>"/> <input type="hidden" name="course_date" value="<?= date("d-m-y", strtotime(get_sub_field('date'))) ?>"/> <input type="hidden" name="course_location" value="<? the_sub_field('venue') ?>"/> <input type="hidden" name="course_applicant" value="<?= $user_id ?>"/> </tr> <? endfor; ?> </table> <input type="submit" value="confirm registration"/> </form> </div> <?php endwhile; // end of loop. ?> <!-- shopping cart panel (top right) --> <?php include 'order_panel.php'?> <?php get_footer(); ?>

i form resubmit current page. have handler in file handle submission. problem handler never gets called because post array cleared every time page loads. reason tried clearing because if did not handler called first time user brought page.

any advice on how might prepare issue?

array (size=9) 'name' => string '' (length=0) <------- these fields blank.... 'email' => string '' (length=0) 'phone' => string '' (length=0) 'course_id' => string '1063' (length=4) 'course_title' => string 'energy utilize in mushroom units' (length=28) 'formsend2' => string '1' (length=1) 'course_date' => string '23-07-2014' (length=10) 'course_location' => string 'teagasc, thurles' (length=16) 'course_applicant' => string '1' (length=1)

my html blank fields. come in in values in browser blank

<td><input type="text" id="name" name="name"></td> <td><input type="text" id="email" name="email"/></td> <td><input type="text" id="phone" name="phone"/></td>

send hidden value:

<input type="hidden" name="formsend" value="1" />

change check if (!empty($_post)){ to

if (isset($_post['formsend'])){

don't $_post = array();.

php post http-post

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -