I have setup paypal subscription for my website,two types of subscription are there.It works fine in sandbox (test mode) but not on live mode. when user proceed to pay through paypal by entering paypal email and password it shows "The link you have used to enter the PayPal system is invalid. Please review the link and try again".
The code i am using is
echo '<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
echo '<input type="hidden" name="cmd" value="_xclick-subscriptions">';
echo '<input type="hidden" name="business" value="sales#example.com">';
echo '<input type="hidden" name="currency_code" value="USD">';
echo '<input type="hidden" name="no_shipping" value="1">';
echo '<input type="hidden" name="item_name" value=" '.$ite_name.'" />';
echo '<input type="hidden" name="item_number" value="'.time().'" />';
echo '<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - its fast, free and secure!">';
echo '<input type="hidden" name="a3" value="'.$sub[1].'">';
echo '<input type="hidden" name="p3" value="1">';
echo '<input type="hidden" name="t3" value="'.$sub[0].'">';
echo '<input type="hidden" name="src" value="1">';
echo '<input type="hidden" name="sra" value="1">';
echo '<input type="hidden" name="upload" value="1" />';
echo '<input type="hidden" name="custom" value="1000000000'.$insert_id.'">';
echo '<input type="hidden" name="return" value="https://example.com/manage/PNS-Manager/register.php?l=s" />';
echo '<input type="hidden" name="rm" value="2" />';
echo '<input type="hidden" name="cancel_return" value="https://example.com/manage/PNS-Manager/cancel.php" />';
echo '<input type="hidden" name="notify_url" value="http://example.com/manage/PNS-Manager/IPN.php" />';
echo '</form>';
echo "<script> document.forms[0].submit();</script>";
Anybody have any idea whats the problem..???? please help
Can you provide the string of what you are passing over for these values, so that we can try testing it and see what's causing the error. It may be an issue with one of the values you are setting for the variables. Also, when switching to live, make sure that you change the business variable from your sandbox account to your live account.
Related
How to show double quote in input tag ?
my $test is i test "hello"
and input like this
<input name="test" type="text" value="<?PHP echo $test; ?>">
When test code in input show only i test
How can i do for show i test "hello" in input tag ?
Try to use htmlspecialchars or use htmlentities
<input name="test" type="text" value="<?php echo htmlspecialchars($test); ?>">
<input name="test" type="text" value="<?php echo htmlentities($test); ?>">
Or by using PHP echo you can do it
<?php echo '<input name="test" type="text" value="'.$test.'">'; ?>
use html_entity_decode since you're using php like so:
<input name="test" type="text" value="<?PHP echo html_entity_decode($test); ?>">
how can I get the "id" instead of "name" when i submit the form.
<input type="text" list='name' name='test1'/>
<datalist id="test1">
<?php
if(!empty($data)){
foreach($data as $flag){
echo "<option label ='".$flag['id']."' >".$flag['name']."</option>";
}
}else{
echo "<option> empty </option>";
}
?>
</datalist>
I have tried using value = $flag['id'], but I still get "name" when i submit it.
The id is not sent to the server with a regular submitting of a form. Only the name- and value attributes are.
If you really wanted to get the ids too, you could have a hidden <input> element with an array for value, containing all the relevant ids you want.
Here's an example:
HTML
<form method="post">
<input type="text" name="firstname" id="inp1" />
<input type="text" name="surname" id="inp2" />
<input type="hidden" name="ids[]" value="inp1" />
<input type="hidden" name="ids[]" value="inp2" />
<input type="submit" />
</form>
PHP
foreach($_POST['ids'] as $id)
{
echo '<option label="' . $id . '">' . array_search($id, $_POST) . '</option>';
}
What is the best way to post a HTML Form on load? This is what I'm currently trying:
<?php
if ($Autopost == "1");
{
<body onLoad="mail.submit()">
<form method="POST" name="mail" class="adjacent" action="./Script/addmaillist.php">
<input type="hidden" name="email" value="<?php echo $email; ?>">
<input type="hidden" name="genre" value="<?php echo $genre; ?>">
</form>
}
?>
I would just like to know if this is a good way, and if there is a better way?
I agree with Kolink that it seems unnecessary to send information to the client and then back to the server, but assuming you need to do that for some reason, you could use Javascript and jQuery to post a form through the $(document).ready() event, which triggers and runs its contents upon page load. So you would have your form with id="mail" and in your script you could have:
$(document).ready(function() {
$("#mail").submit();
}
you don't need any server-side code to submit on-load. also, your code doesn't look quiet right. is that in php?
There are some small syntax errors in your code:
<?php
if ($Autopost == "1")
{ ?>
<body onLoad="mail.submit()">
<form method="POST" name="mail" class="adjacent" action="./Script/addmaillist.php">
<input type="hidden" name="email" value="<?php echo $email; ?>" />
<input type="hidden" name="genre" value="<?php echo $genre; ?>" />
</form>
<?php
}
?>
I have made a query, using mysql_* way, that select's some values from a table, where row's id is 1. Then I put all those values in variables so I can echo them in to my form. How can I do the same thing using Joomla's database query way ?
Here is an example of my code that working, using mysql_*:
<?php // DATABASE QUERY
$query="SELECT countdown_module, hometeam_header
FROM jos_gm_nextmatch
WHERE id = 1";
$result=mysql_query($query);
// DATABASE VARIABLES
$countdown_module = mysql_result($result,$i,"countdown_module"); ?>
$hometeam_header = mysql_result($result,$i,"hometeam_header"); ?>
<form action="" method="post" name="form">
<input name="countdown_module" value="<?php echo $countdown_module ?>" type="text" />
<input name="hometeam_header" value="<?php echo $hometeam_header ?>" type="text" />
<input name="submit" type="submit" value="UPDATE" />
</form>
OK I found it!!! Here is an example...
<?php // DATABASE QUERY
$db = JFactory::getDBO();
$query="SELECT countdown_module, hometeam_header
FROM jos_gm_nextmatch
WHERE id = 1";
$db->setQuery($query);
$rows = $db->loadObjectList();
$itemrow = $rows[0];
// DATABASE VARIABLES
$countdown_module = $itemrow->countdown_module;
$hometeam_header = $itemrow->hometeam_header; ?>
<form action="" method="post" name="form">
<input name="countdown_module" value="<?php echo $countdown_module ?>" type="text" />
<input name="hometeam_header" value="<?php echo $hometeam_header ?>" type="text" />
<input name="submit" type="submit" value="UPDATE" />
</form>
I'm trying to write a dropdown form with a submit button that uses Google translation to translate the current page that I'm on. Here's what I currently have (someone helped me with this):
<form action="http://www.google.com/translate_c" method="get">
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="u" value="<?php echo curPageURL(); ?>" />
<select name="langpair">
<option value="en%7Cafr">English to Afrikaans</option>
<option value="en%7Calb">English to Albanian</option>
...
</select>
<input type="submit" value="Submit" />
</form>
(Echo calls the URL of the current page:)
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
Why does Google think I'm trying to translate from English to English with this code?
I modified your code to the following and it works fine:
<form action="http://www.google.com/translate_c" method="get">
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="sl" value="en" />
<input type="hidden" name="u" value="http://www.stackoverflow.com/" />
<select name="tl">
<option value="af">English to Afrikaans</option>
<option value="sq">English to Albanian</option>
</select>
<input type="submit" value="Submit" />
</form>
I would recheck the curPageURL function and put in the right values for each of the select box items.