Echoing textbox content into POST request not working - php

I am trying to take the textbox content from "mcname" ($custom) and POST that into "item_name" however it doesn't POST anything? I've looked around, but I still cannot find my solution?
At the top of my script before any HTML:
<?php
$custom = $_post['mcname'];
?>
The textbox, form post, and button in the middle of the script.
<input type="text" name="mcname" id="mcname" placeholder="Enter your username hereā€¦" />
<br/>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="formval">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="__#gmail.com">
<input type="hidden" name="item_name" value="<?php echo $custom; ?>">
<input type="hidden" name="amount" value="$10.00">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="http://__.com/upgrade" />
<input type="hidden" name="cancel_return" value="http://__.com/upgrade" />
<input type="hidden" name="notify_url" value="http://__.com/ipn/ipn.php">
<input type="hidden" name="custom" value="Iron">
<button type="submit" class="btn btn-primary" href="#" rel="tooltip" data-placement="bottom" title="Click here to continue to PayPal." ><i class="icon-shopping- cart"></i>Checkout</a>
</form>

POST is case sensitive, try:
$custom = $_POST['mcname'];

Well, your code is fine, the problem is:
$custom = $_post['mcname'];
change it to:
$custom = $_POST['mcname'];

POST is a super global and must be capitalized:
$custom = $_POST['mcname'];
Also, your textarea element is outside of your form, it needs to be inside the form tags.

Related

PHP Paywall Form Outputs Black Screen

I wrote a basic PHP script that contains a form that is supposed to when submitted open a Paypal buy now dialog and then echo "paid" once it has been paid.
For some reason it just shows a black screen with a small square after submitting the first form. It never gets to the paypal button form.
I have tried passing variables through paypal to keep them when it returns to the page and the php syntax checker detects zero issues.
Here is the code:
if(!isset($_POST["form1"])) {
if (!isset($_POST["payment_status"])) {
echo '<form action="article.php" method="post" ><input type="url" name="logo" placeholder="your .PNG logo" size="14"><input type="text" name="title" placeholder="title" size="14"><input type="hidden" name="form1" value="form1" size="14"><input type="submit" name="submit" value="submit"></form>';
}
}
if(isset($_POST["form1"])) {
header('Content-type: image/png');
$title = $_POST["title"];
$image3 = $_POST["logo"];
$dataa = $title;
$dataa .= $logo;
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<br>
<input name="currency_code" type="hidden" value="USD">
<input name="shipping" type="hidden" value="0.00">
<input name="tax" type="hidden" value="0.00">
<input type="hidden" name="amount" value="0.20">
<input name="return" type="hidden" value="http://example.com/article.php/?data=$dataa">
<input name="cancel_return" type="hidden" value="http://example.com">
<input name="notify_url" type="hidden" value="http://example.com/article.php">
<input name="cmd" type="hidden" value="_xclick">
<input name="business" type="hidden" value="example#example.com">
<input name="item_name" type="hidden" value="digital download">
<input name="no_note" type="hidden" value="1">
<input type="hidden" name="no_shipping" value="1">
<input name="lc" type="hidden" value="EN">
<input name="bn" type="hidden" value="PP-BuyNowBF">
<input name="custom" type="hidden" value="pass form data here">
<input type="submit" name="submit" value="download survey results $2">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>';
}
if (isset($_POST["payment_status"])) {
$payment_status = $_POST['payment_status'];
if ($payment_status == "Completed") {
echo "paid";
echo "<h1>Here is the unlocked article</h1>";
}
}
else {
echo "";
}
?>

Paypal not returning CUSTOM field variable as post data

I have a paypal form where I have a custom and CatDescription field. But
From
<form name="paypalForm" action="paypal.php" method="post" id="paypalform">
<input type="hidden" name="business" value="shubhamjha900#gmail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="id" value="">
<input type="hidden" name="CatDescription">
<input type="hidden" name="custom">
<input type="hidden" name="key" value="<?php echo md5(date("Y-m-d:").rand()); ?>">
<input type="hidden" name="payment" required>
<input type="submit" value="Pay Now">
</form>
The problem is that on my IPN page when the post data are sent back they send all the data but not the custom and CatDescription field data. Please tell me what can be the issue and how can I solve it. Can I use any other field by which I can send data? Whatever be the solution please help me.

PayPal IPN - Changing from Sandbox to Live stops working

I am using the PayPal IPN System which works perfectly in sandbox mode. All the payments went through successfully and my site updated as required. So, being ready to go live, I change my sandbox links to live links:
$action = 'https://www.paypal.com/cgi-bin/webscr';
But now, whenever the payment form is posted to this address, it ends up at
https://www.paypal.com/webapps/hermes?token=...
which just shows a blank page. No error_log is created on my server.
Here is my form data before the link to PayPal is clicked.
<form name="frm_payment_method" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="business" value="payments#domain.com">
<input type="hidden" name="notify_url" value="http://domain.com/ipn.php">
<input type="hidden" name="cancel_return" value="http://domain.com/cancelled.php">
<input type="hidden" name="return" value="http://domain.com/success.php">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="lc" value="">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="page_style" value="paypal">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="item_name" value="1 Credit">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" name="amount" value="1.50">
<p><button type="submit" name="submit" class="btn btn-primary">Proceed to PayPal</button>
Cancel</p></form>
Of course, replacing domain.com with my own correct domains.

Problems with posting Paypal values

It is assumed that using the form, variables are passed by post method to return page, but it is not doing that, and I don't know what I can do about it, since transit through the Paypal website is out of my control.
Any idea?
This is my button. I have the same situation with another one.
<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="name#dom.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="item_name" value="Algo">
<input type="hidden" name="amount" value="8.00">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="item_number" value="<?php echo $_GET['id'];?>">
<input type="hidden" name="custom" value="<?php echo $_GET['sub'];?>">
<input type="hidden" name="return" value="http://www.web.com/ok.php">
<input type="hidden" name="cancel_return" value="http://www.web.com/ko.php">
<input type="image" src="http://www.paypal.com/img/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal">
</form>
You can pass the variables by setting them as url parameters in the return page. Like this:
<input type="hidden" name="return" value="http://www.web.com/ok.php?id=<?php echo $_GET['id'];?>&custom=<?php echo $_GET['sub'];?>">

PayPal Checkout with Multiple Items with Quantuty - Unknown Error

I am trying send a PayPal multiple items with quantity and amount in a shopping cart. When i try to send the following i get a unknown error. i dont know why
<form name="check_out_form" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="sales#ss.com"/>
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="item_number_1" value="1"/>
<input type="hidden" name="item_name_1" value="Featured: 3"/>
<input type="hidden" name="amount_1" value="9.95"/>
<input type="hidden" name="quantity_1" value="3"/>
<input type="hidden" name="item_number_2" value="2"/>
<input type="hidden" name="item_name_2" value="Standard: 2"/>
<input type="hidden" name="amount_2" value="2.95"/>
<input type="hidden" name="quantity_2" value="2"/>
<input type="hidden" name="page_style" value="Career"/>
<input type="hidden" name="no_note" value="1"/>
<input type="hidden" name="no_shipping" value="1"/>
<input type="hidden" name="return" value="http://www.sss.com/welcome.php?id=success"/>
<input type="hidden" name="return_cancel" value="http://www.sss.com/welcome.php"/>
<input type="hidden" name="custom" value="id|1-custom|1-fea|9.95|3|29.85-std|2.95|2|5.9-total|"/>
<input type="hidden" name="notify_url" value="http://www.sss.com/ipn.php"/>
<input type="hidden" name="cbt" value="Complete Upgrade">
<input type="submit" name="button" id="button" value="Pay now"/>
</form>
I cant figure out what i am doing wrong here i get error saying
"We have detected a problem with this shopping cart. If the problem persists, please contact the merchant. At this time, we are unable to process your request. Please return to xxl and try another option."
Add a new variable called "upload", so it might look like:
...
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
...
Tried it, worked with your code in my PP-Sandbox.

Categories