1

Link to checkout the form Here's what i tried in Jquery:

$('#third_n').bind('keypress click',function(){

    $('p#p_service').text($('#id_service').val());
    $('p#p_rate').text($('#id_rate').val());
    $('p#p_imei').text($('#imei').val());
    $('p#p_device').text($('#id_device').val());

    var a= $('#id_device').val();
    var b= $('#id_rate').val();
    var c= $('#id_service').val();
    alert(a);
    alert(b);
    alert(c);
    });

Her's the part of jquery code that set the .val() function

var ser_val = $('#ssamsung').val();
$('#id_service').val(ser_val);
$('#id_device').val('iPhone 5');
$('p#rate').text($('#id_rate').val());

And my corresponding HTML:

<form class="nobottommargin" method="post" action="shop_paypal.php">

<label>IMEI: <small>*</small></label>
<input type="text" value="" class="required input-block-level"  id="imei" maxlength="15" required/>
<label>Cost:</label>
<input id="id_rate" type="hidden" name="na_rate">
<p id="rate"></p>
<label>Notice:</label>
<p id="p_notice"></p>
<label>Details:</label>
<p id="p_details"></p>
<label>FIRST NAME:</label>
<input type="text" value="" id="FN" name="first_n" required/>
<label>LAST NAME:</label>
<input type="text" value="" id="LN" name="first_n" required/>
<label>EMAIL: </label>
<input type="email" value="" id="EML" name="first_EML" required/>
<label>Device:</label>
<input id="id_device" type="hidden" name="na_device" value="">
<p id="p_device"></p>
<label>IMEI:</label>
<p id="p_imei"></p>
<label>Service:</label>
<input id="id_service" type="hidden" name="na_service" value="">
<p id="p_service"></p>
<label>Rate:</label>
<p id="p_rate"></p>
<label>Name:</label>
<p id="p_name"></p>
<label id="l_email">Email:</label>
<p id="p_email"></p>
<input type="submit" class="simple-button large" id="submit">
</form>

Till here every thing is fine, getting right alerts via jquery and the text correctly gets set in<p> tags.

But this Corresponding PHP Code echoes nothing:

<?php
session_start();
   $rate = $_POST['na_rate'];
   $device = $_POST['na_device'];
   $service= $_POST['na_service'];
   $email = $_POST['first_EML'];
   echo $email;
   echo $device;
   echo $service;
   die(0);

I'm not sure why? Any help is much appreciated. Thanks

17
  • 1
    How does your <form> look like? Sounds to me as if your method might be GET or that you didn't even put it in a <form> element, or with the wrong action attr Commented Feb 3, 2014 at 14:26
  • your hidden fields have no value attribute, and you're not setting any via your JS code, so your form is basically submitting permanently empty fields. Commented Feb 3, 2014 at 14:27
  • @MarcB they simply have no default value, but if he submits with user input it should work Commented Feb 3, 2014 at 14:27
  • @ChenAsraf: WHAT user input? they're hidden fields. Commented Feb 3, 2014 at 14:27
  • 1
    include the form start & end with your question.. please Commented Feb 3, 2014 at 14:28

1 Answer 1

1

Your POST has duplicate entries.

Firebug:

first_EML   [email protected]
first_n hgfhgf
first_n hgfhgf
na_10421    Tool for network identification iPhone
na_10422    Tool for network identification iPhone
na_2784 iPhone Rogers/fido
na_6117 iPhone Rogers/fido
na_7524 iPhone Rogers/fido
na_8303 iPhone Rogers/fido
na_9130 iPhone Telux/fido
na_9727 iPhone Telux/fido
na_apple    2784
na_bbm  2107
na_blackberry   Rogers/Fido Express
na_device   
na_device   
na_htc  653
na_lg   982
na_motorola 8475
na_nokia    10099
na_nokia    
na_rate 
na_rate 
na_rate 
na_samsung  7725
na_service  
na_service  
na_shtc Rogers/Fido Express
na_slg  LG International
na_smotorala    Rogers/Fido Express
na_sony_experia Rogers/Fido Express
na_sonye    658
na_sonyericsson SonyEricsson
na_sonyx    481
na_ssamsung Samsung Canada
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for debugging. I found duplicate entry for name=na_rate everything else was fine. And after removing the redundancy i'm still not getting any value echoed $email.
You don't even have a POST variable called email. Did you get it from first_EML?
yes i am talking about firs_EML and i have stored the $_POST['first_EML'] in $email. I'm sorry that part isn't included in the code posted here.
The post value is there, so it's an issue with your PHP code, post that up please.
Check Updates, Posted whole form from start to end and relevant PHP codes too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.