Friday, 15 January 2010

php - Carry over users details to a new page -



php - Carry over users details to a new page -

i using wordpress , have created list of users links. 1 time clicked need carry person email address on form can send email them directly. automatically populates send email address. have looped through users want send stuck on go here:

<?php $args1 = array( 'role' => 'committee', 'orderby' => 'user_nicename', 'order' => 'asc' ); $committee = get_users($args1); foreach ($committee $user) { echo ' <a href="../contact-form?email=' . $user->user_email . '"><b style="font-size:18px;"> <tr> <td style="padding: 10px;">' .$user->job_title .' - </td> <td style="padding: 10px;">' .$user->display_name .'</td> </tr></b></a><br><br>'; } ?>

i need send persons email address user clicked on send page:

<form role="form" method="post" action=""> <div class="form-group"> <label for="inputname">your name</label> <input type="name" class="form-control" id="inputname" placeholder="enter name"> </div> <div class="form-group"> <label for="inputemail">email address</label> <input type="email" class="form-control" id="inputemail" placeholder="you@example.com"> </div> <div class="form-group"> <label for="inputmsg">message</label> <textarea class="form-control" rows="8" id="inputmsg" placeholder="please begin typing message..."></textarea> </div> <button type="submit" class="btn btn-primary pull-right">send</button> </form>

so if click on persons name take user new page contact form, person clicked on receive email 1 time form submitted. need advice on begin?

just this...

<td style="padding: 10px;"> <a href="urlwheretogetform?email=<?php echo $user->user_email;?>"> <?php echo $user->display_name;?> </a> </td>

then on other page...

if(isset($_get['email'])){ $email = $_get['email']; } // wahtever afterwards

in more detail

<?php if(isset($_get)){ $email = $_get['email']; } else {$email='';};?> <form role="form" method="post" action=""> //your other fields <div class="form-group"> <label for="inputemail">email address</label> <input type="email" class="form-control" id="inputemail" placeholder="you@example.com" value="<?php echo $email;?>"> </div> <button type="submit" class="btn btn-primary pull-right">send</button> </form>

php wordpress

No comments:

Post a Comment