-1

This is my Jquery:

var data = '[sh][co][img]';
  $.post('../php/forms/postdata.php?type=imgadder&c='+code+'&part=partone', 'partone=' + data, function (response) {
  $('#body-text').insertAtCaret(response);
});
 var datatwo = ''+linko+'[s][/s][/img][ctr][/ctr][/co][/sh]';
 $.post('../php/forms/postdata.php?type=imgadder&c='+code+'&part=parttwo', 'parttwo=' + datatwo, function (response) {
 $('#body-text').insertAtCaret(response);
});
I get an error "Undefined Index Error" but the index exists, because it prints correctly!

Why is this error message showing when the variable exists?

$partone = e($_POST['parto']);
$parttwo = e($_POST['partt']);
fool-dev
  • 7,671
  • 9
  • 40
  • 54
Sammyjo20
  • 79
  • 2
  • 9

1 Answers1

0

You are trying with wrong index. It should be

$partone = e($_POST['partone']);
$parttwo = e($_POST['parttwo']);

Note : Also, I think you are trying to get both at the same time, where you have two different requests for each one. When you are sending partone, you are not sending parttwo, and vice versa. So you need to handle it differently.

  • If the error is ignored, it works. Should I just turn off error reporting? – Sammyjo20 Dec 18 '15 at 15:15
  • I think you are trying to get both at the same time, where you have two different requests. When you are sending `partone`, you are not sending `parttwo`, and vice versa. So, question here is do you want to actually send both or you want to act with anyone with each request? – Tᴀʀᴇǫ Mᴀʜᴍᴏᴏᴅ Dec 18 '15 at 15:21
  • Ah, I understand now. I can't explain it but I get it. Thanks mate! – Sammyjo20 Dec 18 '15 at 15:22