doujia5863 2016-01-24 18:35
浏览 26

Paypal从数据库查询'立即购买'

So that I can dynamically determine which paypal seller e-mail address to use when clicking the Buy Now button, I would like to retrieve the paypal e-mail address using an sql query based on a selection from a Select Option (dropdown) box.

Does anybody know if this can be done? This is the code I have so far, but it doesn't capture the 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 to populate business field for 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 FROM {$wpdb->prefix}payment_booking_project WHERE 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 a little more context, when this form loads, it populates a <select> input from the database. I want to use part of the results of this to find the e-mail address. This PHP looks as 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 * FROM `{$wpdb->prefix}payment_booking_project` WHERE project_status =1";
                $project_list = $wpdb->get_results($sql);
                foreach($project_list as $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>
  • 写回答

1条回答 默认 最新

  • dqmfo84644 2016-01-31 09:56
    关注

    Plz confirm if your query is picking the email addresses as desired? To confirm remove the type= "hidden" from the Input field or echo the query result once before populating to the hidden input field echo $result->project_paypal_address; ??

    评论

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持