Jump to content

no insert with post


dflow
 Share

Recommended Posts

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);

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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();'>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.