unemployment Posted April 15, 2011 Share Posted April 15, 2011 I don't know how to debug this. The if is being executed and I want to have the else be executed. How can I find out what $_POST['id'] is? if (isset($_POST['id']) === false) { echo 'Invalid user id.'; } else { partner_request($_POST['id']); echo "A request has been sent to the user"; } Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/ Share on other sites More sharing options...
drisate Posted April 15, 2011 Share Posted April 15, 2011 if (!isset($_POST['id'])){ echo 'Invalid user id.'; }else{ partner_request($_POST['id']); echo "A request has been sent to the user"; } Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202047 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 if (!isset($_POST['id'])){ echo 'Invalid user id.'; }else{ partner_request($_POST['id']); echo "A request has been sent to the user"; } That's not quite what I was looking for. How can tell if post['id'] has been posted? Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202048 Share on other sites More sharing options...
Muddy_Funster Posted April 15, 2011 Share Posted April 15, 2011 echo 'Value of POST id = '.$_POST['id'].'<br>'; Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202051 Share on other sites More sharing options...
drisate Posted April 15, 2011 Share Posted April 15, 2011 you can also check the hole post array with this echo "<pre>"; print_r($_POST); echo "</pre>"; Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202055 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 hmmm looks like I have nothing in the POST array. Is my form wrong or something? <form action="../partnerRequest.php" method="post"> <button class="submitlink"> <span class="f_right">Associates</span> <img src="../assets/img/becomeassoc.jpg" class="mrs vmiddle" alt="Associates" /> </button> </form> Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202059 Share on other sites More sharing options...
DJTim666 Posted April 15, 2011 Share Posted April 15, 2011 Try this inside your <form>; <input type='hidden' name='id' value='someValue /'> Obviously change someValue to whatever value you want passed to your script. Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202062 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 Try this inside your <form>; <input type='hidden' name='id' value='someValue /'> Obviously change someValue to whatever value you want passed to your script. I got the id to be passed into the array with the hidden input but there is not value outputted with <input type='hidden' name='uid' value='<?php $info['id'];?>' /> Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202068 Share on other sites More sharing options...
Maq Posted April 15, 2011 Share Posted April 15, 2011 Why did you change the name of the field to "uid" when you're using "id"? Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202071 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 I changed it back, but it still fails. No value being passed through. Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202073 Share on other sites More sharing options...
Maq Posted April 15, 2011 Share Posted April 15, 2011 I got the id to be passed into the array with the hidden input but there is not value outputted with ' /> You need to echo the value: ' /> EDIT: changed uid back to id. Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202074 Share on other sites More sharing options...
unemployment Posted April 15, 2011 Author Share Posted April 15, 2011 I got it to work... I needed to echo the value Quote Link to comment https://forums.phpfreaks.com/topic/233821-how-do-i-debug-a-post/#findComment-1202075 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.