Niezdefiniowany indeks w poście PHP
Przyjmuję formularz i sprawdzam zmienne w jquery, a następnie przekazuję je do pliku php w ajax, ale otrzymuję to powiadomienie
Uwaga: Niezdefiniowany indeks: twoja_nazwa w C: xampp htdocs process.php w linii 3 coś tu jest nie tak Uwaga: Niezdefiniowany indeks: twoja_email w C :ampamp htdocs process.php w linii 7
Oto mój kod jquery tutaj
<code> $(".button").click(function(){ $('.error').hide(); var your_email=$("input#your_email").val(); if(your_email ==""){ $("label#youremail_error").show(); $("input#your_email").focus(); return false; } var your_name=$("input#your_name").val(); if(your_name==""){ $("label#yourname_error").show(); $("input#your_name").focus(); return false; } var friends_email=$("input#friends_email").val(); if(friends_email==""){ $("label#friendsemail_error").show(); $("input#friends_email").focus(); return false; } var friends_name=$("input#friends_name").val(); if(friends_email==""){ $("label#friendsname_error").show(); $("input#friends_name").focus(); return false; } var dataString = 'your_email=' + your_email + '&friends_email=' + friends_email + '&your_name=' + your_name + '&friends_name=' + friends_name; //alert(dataString); $.ajax({ type: "POST", url:"process.php", data: dataString, success: function(ret) { alert(ret); //alert("thank you for signing up"); }, </code>
a oto mój PHP
<code> <?php include 'inc/class.phpmailer.php'; if(isset($_POST['your_name'])){ $your_name=$_POST['your_name']; } else{ echo "something is wrong with your name having:"; var_dump($_POST['your_name']); echo "<br/>"; } if(isset($_POST['your_email'])){ $your_email=$_POST['your_email']; } else{ echo "something is wrong with your email having:"; var_dump($_POST['your_email']); echo "<br/>"; } if(isset($_POST['friends_name'])){ $friends_name=$_POST['friends_name']; } else{ echo "something is wrong with friends name having:"; var_dump($_POST['friends_name']); echo "<br/>"; } </code>
Nie jestem pewien, dlaczego otrzymuję to powiadomienie Najwyraźniej moje wartości $ _POST nie są ustawione.
Na tym kończę rozum. Czy wiesz, dlaczego / kiedy nie jest ustawiony $ _POST?