Hello Guys, I need help adding a PayPal Button to one of my site pages. The code I need to add is <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="<? include('paypal.php'); ?>"> <input type="hidden" name="item_name" value="Premium Membership"> <input type="hidden" name="amount" value="<?= $rowe["price"] ?>"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="MX"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></form> Code (markup): I have to add this code to this part of the file <? if (isset($_POST["name"])) { require('config.php'); if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ echo "SECURITY CODE ERROR... "; include('footer.php'); exit(); } $name=limpiar($_POST["name"]); $email=limpiar($_POST["email"]); $topic=limpiar($_POST["topic"]); $subject=limpiar($_POST["subject"]); $comments=limpiar($_POST["comments"]); if ($name==""){echo "Error"; exit();} if ($email==""){echo "Error"; exit();} if ($topic==""){echo "Error"; exit();} if ($subject==""){echo "Error"; exit();} if ($comments==""){echo "Error"; exit();} $laip = getRealIP(); $query = "INSERT INTO tb_contact (name, email, topic, subject, comments, ip) VALUES('$name','$email','$topic','$subject','$comments','$laip')"; mysql_query($query) or die(mysql_error()); echo "Your message has been sent correctly."; ?> Code (markup): Please let me know where I have to add the PayPal Button code in the file script above. If you will be able to help me, I will give you 50 free member visits on my site adbuck.net
Are you sure that's where you want it? I would place it after the ?> but I aint sure you have the correct file.
Yes, the PayPal Button needs to be somewhere inside the <? and ?> because if I would put the PayPal Button outside of those <? and ?> the PayPal Button would be displayed before the Submit Form. And the <? and ?> is the code when the form is submitted. As you can see in the code above, almost the last line "echo "Your message has been sent correctly.";" that message is showing up after the form is submitted and I need to add a PayPal Button under that message.
You will have to wrap it inside of an echo statement . after the echo "your message has been sent" but it makes zero sense cause the php ends there and you should be able to just put the html code. Is this being included in some other file and that php block is being contained by other HTML elements?
It's regarding this page "http://adbuck.net/advertise.php". Fill out all the fields with some info and then click "Submit". After you have clicked "Submit" you will see a new page saying "Your message has been sent correctly." and I would like to have a PayPal button under that text.
echo "Your message has been sent correctly."; echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">'; echo '<input type="hidden" name="cmd" value="_xclick">'; echo '<input type="hidden" name="business" value="' ; include "paypal.php"; echo '">'; echo '<input type="hidden" name="item_name" value="Premium Membership">'; echo '<input type="hidden" name="amount" value="' . $rowe["price"] . '">'; echo '<input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="MX"> <input type="hidden" name="bn" value="PP-BuyNowBF">'; echo '<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0"'; echo 'name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!"></form>'; ?> Code (markup): There I just did to match as best I could
There is no paypal.php file. But I have removed that line and tried it to see if it will work and nothing. It only showed the text and no button. I think I will try to figure out something else, because many people were unable to fix the problem. Even my host and they know a little php. But thanks for trying, if you would like I can give you some free clicks on my site if you have a website.
Well something tells me it's something else cause the above works. http://www.shallowink.com/ts.php Button shows up. So it could be part of the logic proceeding that statement. or the database call.
Just use heredoc syntax: echo <<<EOPF1 Your message has been sent correctly.<br /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value=" EOPF1; include('paypal.php'); echo <<<EOPF2 "><input type="hidden" name="item_name" value="Premium Membership"> <input type="hidden" name="amount" value="{$rowe['price'] }"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="MX"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></form> EOPF2; PHP: It saves you the mess of escaped characters and it's easier to read. If you could get the output from that paypal.php file in a better way you could put it all in one piece.
Yeah, heredocs are easier to read. Doesn't matter though his problem is somewhere other than what he presented. Still don't get calling the include file in that location. Call it beforehand and put the var in place cause I know it's just the business email.
Then what's this? <input type="hidden" name="business" value="<? include('paypal.php'); ?>"> PHP: Agreed.
That file should spit out something, probably at the end. Find where it echos this output and change it to return. //From this echo "Output"; //To this return "Output"; PHP: It may be in the form of a variable instead. Either way, make that change and then on your main script put something like this: $business=include('paypal.php'); echo <<<EOPF Your message has been sent correctly.<br /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="{$business}"> <input type="hidden" name="item_name" value="Premium Membership"> <input type="hidden" name="amount" value="{$rowe['price'] }"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="MX"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></form> EOPF; PHP: That's it.
Could you just add for me the PayPal button code to this code: *I was trying to add teh code, but it didn't work.
Well, assuming you modified the include... <? if (isset($_POST["name"])) { require('config.php'); if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){ echo "SECURITY CODE ERROR... "; include('footer.php'); exit(); } $name=limpiar($_POST["name"]); $email=limpiar($_POST["email"]); $topic=limpiar($_POST["topic"]); $subject=limpiar($_POST["subject"]); $comments=limpiar($_POST["comments"]); if ($name==""){echo "Error"; exit();} if ($email==""){echo "Error"; exit();} if ($topic==""){echo "Error"; exit();} if ($subject==""){echo "Error"; exit();} if ($comments==""){echo "Error"; exit();} $laip = getRealIP(); $query = "INSERT INTO tb_contact (name, email, topic, subject, comments, ip) VALUES('$name','$email','$topic','$subject','$comments','$laip')"; mysql_query($query) or die(mysql_error()); $business=include('paypal.php'); echo <<<EOPF Your message has been sent correctly.<br /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="{$business}"> <input type="hidden" name="item_name" value="Premium Membership"> <input type="hidden" name="amount" value="{$rowe['price']}"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="MX"> <input type="hidden" name="bn" value="PP-BuyNowBF"> <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></form> EOPF; ?> PHP: