php - Paypal 'Buy Now' from a database query -


so can dynamically determine paypal seller e-mail address use when clicking buy button, retrieve paypal e-mail address using sql query based on selection select option (dropdown) box.

does know if can done? code have far, doesn't capture value.

public function getform($project_list, $business){   ?>     <div id="payment_booking_main">                     <!-- <form name="_xclick" id="payment_booking_form" action="https://www.paypal.com/cgi-bin/webscr" method="post"> -->          <form name="_xclick" id="payment_booking_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">             <input type="hidden" name="cmd" value="_xclick" />              <input type="hidden" name="hosted_button_id" value="7acednw8urdk2" />               <!-- <input type="hidden" name="business" value="myemailaddress@website.info" /> -->              <!-- try populate business field paypal e-mail address -->             <input type="hidden" name="business" value="                 <?php                     global $wpdb;                     $paymentproject = $_post['payment_booking_project'];                     $result = $wpdb->get_results("select project_paypal_address {$wpdb->prefix}payment_booking_project project_name='{$paymentproject}'");                      echo $result->project_paypal_address;                 ?>" />              <input type="hidden" name="a3" value="1">             <input type="hidden" name="p3" value="1">             <input type="hidden" name="t3" value="d">             <input type="hidden" name="no_note" value="1">             <input type="hidden" name="currency_code" value="gbp">             <input type="hidden" id="payment_booking_return_url" name="return" value="" />             <input type="hidden" id="payment_booking_notify_url" name="notify_url" value="">             <input type="hidden" id="payment_booking_total_amount" name="amount" value="0">             <input type="hidden" id="payment_booking_item_name" name="item_name" value="">             <input type="hidden" id="payment_booking_item_number" name="item_number" value=""> 

edit:

to provide little more context, when form loads, populates <select> input database. want use part of results of find e-mail address. php looks below:

<div id="payment_booking_project_selectform">     <div class="payment_booking_line" style="heigth:20px !important;">         <span class="payment_booking_label">project :</span>         <select id="payment_booking_project" name="payment_booking_project">             <?php                 global $wpdb;                 $sql = "select * `{$wpdb->prefix}payment_booking_project` project_status =1";                 $project_list = $wpdb->get_results($sql);                 foreach($project_list $project){                     echo '<option value="'.$project->id.'" amount="'.number_format($project->project_amount, 2).'" description="'.$project->project_description.'" price="'.$project->project_price.'">'.$project->project_name.'</option>';                     }              ?>          </select>          <span id="payment_booking_project_description" style="font-size:12px;"></span>      </div> 

plz confirm if query picking email addresses desired? confirm remove type= "hidden" input field or echo query result once before populating hidden input field echo $result->project_paypal_address; ??


Comments