dflow Posted October 31, 2011 Share Posted October 31, 2011 when i remove the action from the form it submits the post correctly if not it goes to the action url withoutposting <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" target="_top" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="wwww"> <?php <input type="hidden" name="item_name" id="item_name" value="<?php echo $md5c;?>"> <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Submit Form"> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> <?php if(isset($_POST['submit_x']) || isset($_POST['submit_x'])) { //$Subscription_id = mysql_real_escape_string($md5c); $PropertyID = mysql_real_escape_string($rowData['ID']); $User_ID = mysql_real_escape_string($rowData['User_ID']); $item_name=mysql_real_escape_string($_POST['item_name']); //$query = 'INSERT INTO SP_subscriptions(id,) values("'.$item_name.'")'; $query = 'INSERT INTO SP_subscriptions(id,PropertyID,User_ID) values("'.$item_name.'","'.$PropertyID.'","'.$User_ID.'")'; $success = mysql_query($query); echo $query; } else echo 'POST nada'; var_dump($_POST); var_dump($query); ?> Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/ Share on other sites More sharing options...
Psycho Posted October 31, 2011 Share Posted October 31, 2011 How do you know it is not posting? You are submitting the data to a paypal page so chances are you are not submitting the data in the manner it expects and is simply not processing the data. You should follow up with the Paypal documentation or support forum. If you can confirm that the form data is POSTed when submitting to your own page, then the data is POSTed. So, the problem is with how that POSTed data is accepted/used. Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283730 Share on other sites More sharing options...
dflow Posted October 31, 2011 Author Share Posted October 31, 2011 How do you know it is not posting? You are submitting the data to a paypal page so chances are you are not submitting the data in the manner it expects and is simply not processing the data. You should follow up with the Paypal documentation or support forum. If you can confirm that the form data is POSTed when submitting to your own page, then the data is POSTed. So, the problem is with how that POSTed data is accepted/used. actually i can say it is posting but it isnt inserting the data into the db when the action is set in the form but the insert is depended on the submit image posted. also when i try to insert if(isset($_POST['isSubmitted$'])) with a predefined isSubmitted=1 it doesnt execute the insert query Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283760 Share on other sites More sharing options...
Pikachu2000 Posted October 31, 2011 Share Posted October 31, 2011 Are you trying to submit the form to paypal and to itself at the same time? Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283765 Share on other sites More sharing options...
Psycho Posted October 31, 2011 Share Posted October 31, 2011 Um, I think one of is confused here and I'm not sure if it is me or you (but I'm thinking the latter). You originally stated that when i remove the action from the form it submits the post correctly if not it goes to the action url withoutposting Now you state that it is posting but it isnt inserting the data into the db when the action is set in the form Your action attribute is: action="https://www.sandbox.paypal.com/cgi-bin/webscr" When you use that action, your form is submitting to Paypal - not to your site. You would never see the POSTed data. You would need to POST the form to a page of yours so you can use that data to update your records and then re-post the data to paypal. Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283771 Share on other sites More sharing options...
dflow Posted October 31, 2011 Author Share Posted October 31, 2011 Are you trying to submit the form to paypal and to itself at the same time? Um, I think one of is confused here and I'm not sure if it is me or you (but I'm thinking the latter). You originally stated that when i remove the action from the form it submits the post correctly if not it goes to the action url withoutposting Now you state that it is posting but it isnt inserting the data into the db when the action is set in the form Your action attribute is: action="https://www.sandbox.paypal.com/cgi-bin/webscr" When you use that action, your form is submitting to Paypal - not to your site. You would never see the POSTed data. You would need to POST the form to a page of yours so you can use that data to update your records and then re-post the data to paypal. by posting i meant that i can see that it posted a variable i set to the paypal page when the action method is set to go to the paypal url. i've been doing some research and people have had a similar problem and one solution is using ajax to submit both post to paypal and to insert data into my db havent tested it out yet <script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript"> function mycall() { $.post('addToMySQL.php', {...}); // Replace ... with arguments return true; } </script> <form action='".PAYPAL_URL."' method='post' onSubmit='return mycall();'> Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283779 Share on other sites More sharing options...
Psycho Posted October 31, 2011 Share Posted October 31, 2011 Right, when you set the action of the form, the form data is sent to that page (in this case PayPal). When you leave the action parameter blank the page posts to itself. That is why you can access the data when you leave the action blank. As stated previously, you will need to post the data to one of your pages, process it and rePOST to PayPal. Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283783 Share on other sites More sharing options...
dflow Posted October 31, 2011 Author Share Posted October 31, 2011 Right, when you set the action of the form, the form data is sent to that page (in this case PayPal). When you leave the action parameter blank the page posts to itself. That is why you can access the data when you leave the action blank. As stated previously, you will need to post the data to one of your pages, process it and rePOST to PayPal. how would you tackle this? mainly the repost to paypal? Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283802 Share on other sites More sharing options...
bspace Posted November 1, 2011 Share Posted November 1, 2011 HTTP POST from PHP, without cURL http://wezfurlong.org/blog/2006/nov/http-post-from-php-without-curl/ Quote Link to comment https://forums.phpfreaks.com/topic/250172-no-insert-with-post/#findComment-1283867 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.