post - Radio buttons: PHP only passing "Other" value -


i've borrowed several versions of php (from here , other sites) pass selected amount in radio fieldset ecommerce gateway, regardless of have tried, pass amount entered "other" field (which simple text box). of radio buttons selected, error indicating field missing or wrong format. first time using php, assistance provided @ first-grade level appreciated! though problem seems related if else if statement, included entire php because don't understand how php works. thanks.

    <?php  $x_login = "hco-st.-t-902"; //  hosted payment page id.  $transaction_key = "6~~xpvr~xmjxn_rkcc99"; //   if(isset($_post['amount'])) {     if($_post['amount'] == '5') {         $x_amount = "5.00";     } elseif($_post['amount'] == '10') {         $x_amount = "10.00";     } elseif($_post['amount'] == '25') {         $x_amount = "25.00";     } elseif($_post['amount'] == '50') {         $x_amount = "50.00";     } elseif($_post['amount'] == '100') {         $x_amount = "100.00";     } elseif($_post['amount'] == '200') {         $x_amount = "200.00";     } elseif($_post['amount'] == 'other') {         $x_amount = $_post['amount'];      } }  $x_invoice_num = $_post['invoice']; $x_first_name = $_post['x_first_name']; $x_email = $_post['x_email']; $cardholdersname= $_post['cardholdersname']; $x_currency_code = "usd"; // needs agree currency of payment page srand(time()); // initialize random generator x_fp_sequence $x_fp_sequence = rand(1000, 100000) + 123456; $x_fp_timestamp = time(); // needs in utc. make sure webserver produces utc  // values contribute x_fp_hash  $hmac_data = $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^" . $x_currency_code; $x_fp_hash = hash_hmac('md5', $hmac_data, $transaction_key);  echo ('<input type="hidden" name="x_login" value="' . $x_login . '">' ); echo ('<input type="hidden" name="x_amount" value="' . $x_amount . '">' ); echo ('<input type="hidden" name="x_fp_sequence" value="' . $x_fp_sequence . '">' ); echo ('<input type="hidden" name="x_fp_timestamp" value="' . $x_fp_timestamp . '">' ); echo ('<input type="hidden" name="x_fp_hash" value="' . $x_fp_hash . '" size="50">' ); echo ('<input type="hidden" name="x_currency_code" value="' . $x_currency_code . '">'); echo ('<input type="hidden" name="x_invoice_num" value="' . $x_invoice_num . '">'); echo ('<input type="hidden" name="x_first_name" value="' . $x_first_name . '">'); echo ('<input type="hidden" name="x_email" value="' . $x_email . '">'); ?> <input type="hidden" name="x_show_form" value="payment_form"/>  </form> 

html

<fieldset name="amount"> <legend><h3>amount**</h3></legend> <hr class="hr"> <p style="margin:0"> <input name="amount" type="radio" value="5" checked="checked"> $5.00 <input name="amount" type="radio" value="10"> $10.00 <input name="amount" type="radio" value="25"> $25.00<br> <input name="amount" type="radio" value="50"> $50.00 <input name="amount" type="radio" value="100"> $100.00 <input name="amount" type="radio" value="200"> $200.00 </p> <input name="amount" type="radio" value="other"><span style="text-decoration: underline">other amount:  </span> <input name="amount" type="text" style="width:100%"> </fieldset> 

looking @ html-code:

<fieldset name="amount"> <legend><h3>amount**</h3></legend> <hr class="hr"> <p style="margin:0"> <input name="amount" type="radio" value="5" checked="checked"> $5.00 <input name="amount" type="radio" value="10"> $10.00 <input name="amount" type="radio" value="25"> $25.00<br> <input name="amount" type="radio" value="50"> $50.00 <input name="amount" type="radio" value="100"> $100.00 <input name="amount" type="radio" value="200"> $200.00 </p> <input name="amount" type="radio" value="other"><span style="text-decoration: underline">other amount:  </span> <input name="amount" type="text" style="width:100%"> </fieldset> 

last html-element same name (amount) previous used , in case of type text. (it "overrides" previous radio-buttons)

if change name of text-field value of selected radio-button when form submitted instead.

try like:

<fieldset name="amount"> <legend><h3>amount**</h3></legend> <hr class="hr"> <p style="margin:0"> <input name="amount" type="radio" value="5" checked="checked"> $5.00 <input name="amount" type="radio" value="10"> $10.00 <input name="amount" type="radio" value="25"> $25.00<br> <input name="amount" type="radio" value="50"> $50.00 <input name="amount" type="radio" value="100"> $100.00 <input name="amount" type="radio" value="200"> $200.00 </p> <input name="amount" type="radio" value="other"><span style="text-decoration: underline">other amount:  </span> <input name="otheramount" type="text" style="width:100%"> </fieldset> 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -