SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Small Issue with a field

    I have an issue with my code this piece of code is for paypal payment i'd like to add or hard code a input or select box to my check box tag so it can calculate the quantity

    Please help

    Thanks!

    PHP Code:

    <?php
    global $wpdb$paypali_membership_vars$posted;
    ?>

    <div id="paypali_membership_form">
      <?php 
            
    if (isset($errors) && sizeof($errors)>&& $errors->get_error_code()) :
                    echo 
    '<ul class="errors">';
                    foreach (
    $errors->errors as $error) {
                            echo 
    '<li>'.$error[0].'</li>';
                    }
                    echo 
    '</ul>';
            endif; 
            
    ?>
      <form id="paypali_membership_form" method="post" action="<?php
            
    global $post;
            if (
    is_single() || is_page()) :
                    echo 
    get_permalink($post->ID);
            else :
                    
    $pageURL 'http';
                    if (
    $_SERVER["HTTPS"] == "on"$pageURL .= "s";
                    
    $pageURL .= "://";
                    if (
    $_SERVER["SERVER_PORT"] != "80"$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
                    else 
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
                    echo 
    $pageURL;
            endif;
        
    ?>" name="membershipform">
        <?php if (!is_user_logged_in()) : ?>
        <fieldset>
          <legend>
          <?php _e('Please fill in the following form to subscribe','paypali'); ?>
          </legend>
          <div>
            <label for="username"><span class="required">*</span>
              <?php _e('Username','paypali'); ?>
            </label>
            <input type="text" id="username" name="username" class="text" value="<?php if (isset($posted['username'])) echo $posted['username']; ?>" />
          </div>
          <div>
            <label for="firstname"><span class="required">*</span>
              <?php _e('Firstname','paypali'); ?>
            </label>
            <input type="text" id="firstname" name="firstname" class="text" value="<?php if (isset($posted['firstname'])) echo $posted['firstname']; ?>" />
          </div>
          <div>
            <label for="username"><span class="required">*</span>
              <?php _e('Lastname','paypali'); ?>
            </label>
            <input type="text" id="lastname" name="lastname" class="text" value="<?php if (isset($posted['lastname'])) echo $posted['lastname']; ?>" />
          </div>
          <div>
            <label for="email"><span class="required">*</span>
              <?php _e('Email','paypali'); ?>
            </label>
            <input type="text" id="email" name="email" class="text" value="<?php if (isset($posted['email'])) echo $posted['email']; ?>" />
          </div>
          <div>
            <label for="password"><span class="required">*</span>
              <?php _e('Password','paypali'); ?>
            </label>
            <input type="password" id="password" name="password" class="text input-short" value="<?php if (isset($posted['password'])) echo $posted['password']; ?>" placeholder="<?php _e('Enter password','paypali'); ?>" />
            <input type="password" id="password2" name="password2" class="text input-short" value="<?php if (isset($posted['password2'])) echo $posted['password2']; ?>" placeholder="<?php _e('Enter again','paypali'); ?>" />
          </div>
          <?php endif; ?>
          <fieldset>
            <legend>
            <?php _e('Choose a Membership Pack','paypali'); ?>
            </legend>
            <?php
                                            $free 
    false;
                                            
    $sql_packs sprintf("SELECT * FROM %s ORDER BY id;",
                                                    
    $wpdb->escape$paypali_membership_vars['membership_database'] ));      
                                            
    $packs $wpdb->get_results($sql_packs);
                                            if (!empty(
    $packs)) :
                                                    
    $alt = -1;
                                                    foreach ( 
    $packs as $pack ) : 
                                                            
    ?>
            <p class="radio <?php if ($alt==1) echo 'alt'?>">
              <input type="text" width="10" name="pack[]" class="radio" id="pack_<?php echo $pack->ID?>" value="<?php echo $pack->ID?><?php if (isset($posted['pack']) && $posted['pack']==$pack->ID?> />
          
              
           
       
              
              <label for="pack_<?php echo $pack->ID?>" class="radio">
                <?php 
                                                                    
    echo $pack->membership_name.' &ndash; <strong>';
                                                                    if (
    $pack->membership_price>0) :
                                                                            echo 
    paypali_currency_wrap($pack->membership_price); 
                                                                    else :
                                                                            echo 
    __('Free''paypali');
                                                                            
    $free true;
                                                                    endif;
                                                                    echo 
    '</strong>'
                                                                    if (
    $pack->membership_desc) :
                                                                            echo 
    '<small>'.$pack->membership_desc.'</small>';
                                                                    endif;
                                                            
    ?>
              </label>
            </p>
            <?php
                                                            $alt 
    $alt*-1;
                                                    endforeach;
                                            endif;
                                    
    ?>
            <p class="checkbox">
              <input type="checkbox" name="auto_renew" id="auto_renew" <?php if (isset($posted['auto_renew']) && $posted['auto_renew']) echo 'checked="checked"'?> />
              <label for="auto_renew">
                <?php _e('Automatically renew?''paypali'); ?>
              </label>
            </p>
          </fieldset>
          <div>
            <input type="submit" name="membershipform" class="submit" value="<?php _e('Subscribe &rarr;''paypali'); ?>" />
          </div>
          <?php if (!is_user_logged_in()) : ?>
        </fieldset>
        <?php endif; ?>
      </form>
    </div>

  2. #2
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can anyone help please!!!

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Sorry What i meant was when the code is populated on the browser i get 3 options
    and the 3 options you can choose one of them by selecting the checkbox what i'd like to do is, add a small field which you can specify a quantity so when you checkout to paypal it shows you that whatever quantity you selected.


    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •