Paypalform submission is forwarded to the default paypal website - html

I have a form that I want to submit to paypal. When I submit the form I don't get to the overview for the submitted product but I end up on the default page for paypal.
I started with http://sandbox.paypal.com but I tried the non-sandbox site too.
<form action="http://sandbox.paypal.com/cgi-bin/webscr" id="paypal_form" method="post" name="paypal_form">
<input name="cmd" type="text" value="_xclick">
<input name="business" type="text" value="some#email.com">
<input name="lc" type="text" value="CH">
<input name="item_name" type="text">
<input name="item_number" type="text">
<input name="amount" type="text">
<input name="currency_code" type="text" value="CHF">
<input name="no_note" type="text" value="1">
<input type="text" name="return" value="http://google.com">
<input name="address_override" type="text" value="1">
<input name="country" type="text" value="CH">
<input name="first_name" type="text">
<input name="last_name" type="text">
<input name="address1" type="text">
<input name="zip" type="text">
<input name="city" type="text">
<input name="email" type="text">
</form>
Since I don't get an error at all, I have no idea what is going wrong. I had cases when Paypal told me that I have to provide a city or something like that but now I just get forwarded.
Note: The Charles Proxy tells me that the form was submitted with these values:

The issue is with the action address in your form. You are posting to "http://sandbox.paypal.com/cgi-bin/webscr". Try using "https://www.sandbox.paypal.com/cgi-bin/webscr" instead.

Related

Validating required input before onlick submit redirect

I am writing the following HTML code which requires certain input values and has a submit button which redirects to a different site when clicked. Currently the Submit button redirects even if no value is entered into the input boxes. I want the submit button to only work if all the input values are filled.
<!DOCTYPE html>
<html>
<body>
<h3>Please enter the following information</h3>
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="" required><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="" required><br>
<label for="email">Email:</label><br>
<input type="text" id="email" name="email" value="" required><br>
<label for="UserID">UserID:</label><br>
<input type="text" id="UserID" name="UserID" value="" required><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password" value="" required><br><br>
<input onclick="window.location.href = 'https://example.site';" type="submit" value="Submit" />
</form>
</body>
</html>
The reason is because your submit isn't properly structured.
You see, if you replace your input submit with a button, it works perfectly:
<!DOCTYPE html>
<html>
<body>
<h3>Please enter the following information</h3>
<form action="https://example.site">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="" required><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="" required><br>
<label for="email">Email:</label><br>
<input type="text" id="email" name="email" value="" required><br>
<label for="UserID">UserID:</label><br>
<input type="text" id="UserID" name="UserID" value="" required><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password" value="" required><br><br>
<button>Submit</button>
</form>
</body>
</html>
All you would have to change is add the link which you want it to redirect to in the action defined in the form.
This is the recommended method.
Keep in mind that you should always perform server-side checks regardless of whether there is a required attribute in the input field, as it can easily be removed.

Mailto <Form> create breaks in the actual email

This is my code:
<form action="mailto:helpdesk#work.com?subject=Websense Block Page" method="post" enctype="text/plain>
User Name: $*WS_USERNAME*$<br>
<input type="text" name="name" value ="$*WS_USERNAME*$"><br>
<STRONG>Workstation:</STRONG><br>
<input type="text" name="WORKSTATION"value ="$*WS_WORKSTATION*$"><br>
<STRONG>Current Date:</STRONG><br>
<input type="text" name="DATE" value ="$*WS_DATE*$"><br>
<STRONG>Category:</STRONG><br>
<input type="text" name="CATAGORY" value ="$*WS_CATEGORY*$"><br>
<STRONG>Requested URL:</STRONG><br>
<input type="text" name="RequestedURL" value ="$*WS_URL*$"><br>
<STRONG>Comment:</STRONG><br>
<input type="text" name="COMMENT" size="50"><br><br>
<STRONG>Status</STRONG>: Is this an Emergency?
<input type="radio" name="emergency" value="YES">Yes
<input type="radio" name="emergency" value="no">No
<br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
The output of this puts all of the information in a single line in the body of the email. Is there a way to put each field in a new row in the email?

How to pre-populate phone in paypal checkout?

I am trying to pre-populate all the fields in the paypal page, but the phone is not populating.
Here is my code:
<INPUT TYPE="hidden" NAME="first_name" VALUE="John">
<INPUT TYPE="hidden" NAME="last_name" VALUE="Doe">
<INPUT TYPE="hidden" NAME="address1" VALUE="9 Elm Street">
<INPUT TYPE="hidden" NAME="address2" VALUE="Apt 5">
<INPUT TYPE="hidden" NAME="city" VALUE="Berwyn">
<INPUT TYPE="hidden" NAME="state" VALUE="PA">
<INPUT TYPE="hidden" NAME="zip" VALUE="19312">
<INPUT TYPE="hidden" NAME="lc" VALUE="US">
<INPUT TYPE="hidden" NAME="email" VALUE="buyer#domain.com">
<INPUT TYPE="hidden" NAME="night_phone_a" VALUE="610">
<INPUT TYPE="hidden" NAME="night_phone_b" VALUE="555">
<INPUT TYPE="hidden" NAME="night_phone_c" VALUE="1234">
What am I missing?
This is a bug in PayPal and the PD team has been working towards a fix.

Post one of two forms using a dropdown submit button

I'm trying to post two different sets of mixed values. Each form will share some user submitted text like name and email.
<form method="post" action="url1">
<input type="hidden" name="donate" value="food">
<input type="hidden" name="days" value="30">
<input type="text" name="cans" value="5">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
<input type="submit" name="submit" value="join1"/>
</form>
<form method="post" action="url1">
<input type="hidden" name="donate" value="shoes">
<input type="text" name="pairs" value="">
<input type="text" name="style" value="">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
<input type="submit" name="submit" value="join2"/>
</form>
<possible dropdown>
It would be ideal to have Dropdown select between the two forms and submit.
Well, using only html you will get a problem as a submit button only submit its own form.
It's also not valid to have forms in other forms.
However, is a trick to accomplish your goal using javascript!
With a little function you can e.g. hide all other forms than one:
function showform(index){
var forms = document.forms;
for(var i=0;i<forms.length;i++)
forms[i].style.display=(i==index?"block":"none");
}
Then you only need to add the onchange-event on your dropdown-list and hide one of the forms by default.
This would result in something like this:
<html>
<head>
<style language="css" type="text/css">
form input{display:block;width:100px;}
</style>
<script language="javascript" type="text/javascript">
function showform(index){
var forms = document.forms;
for(var i=0;i<forms.length;i++)
forms[i].style.display=(i==index?"block":"none");
}
</script>
</head>
<body>
<select onchange='showform(this.selectedIndex);'>
<option>form1</option>
<option>form2</option>
</select>
<form method="post" action="url1">
<input type="hidden" name="donate" value="food"/>
<input type="hidden" name="days" value="30"/>
<input type="text" name="cans" value="5"/>
<input type="text" name="full_name" value=""/>
<input type="text" name="email" value=""/>
<input type="submit" name="submit" value="join1"/>
</form>
<form id='form2' style='display:none' method="post" action="url2">
<input type="hidden" name="donate" value="shoes"/>
<input type="text" name="pairs" value="2"/>
<input type="text" name="style" value=""/>
<input type="text" name="full_name" value=""/>
<input type="text" name="email" value=""/>
<input type="submit" name="submit" value="join2"/>
</form>
</body></html>
If you don't like javascript, you would need to do that in php by using an additional form for the select-element and insert only the wanted form (or hide the others).
I already see some design issues with the way you have planned your multi-form setup, there are much better techniques to handle this - but I will try to help you using your own technique.
By using your own example, this should work for you:
<form id="join1" method="post" action="url1">
<input type="hidden" name="donate" value="food">
<input type="hidden" name="days" value="30">
<input type="text" name="cans" value="5">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
</form>
<form id="join2" method="post" action="url1">
<input type="hidden" name="donate" value="shoes">
<input type="text" name="pairs" value="">
<input type="text" name="style" value="">
<input type="text" name="full_name" value="">
<input type="text" name="email" value="">
</form>
<select id="formList">
<option value="">Select form..</option>
<option value="join1">Join1</option>
<option value="join2">Join2</option>
</select>
<button id="submitBtn">Submit</button>
And this is the javascript for making it happen (using jQuery):
$('#submitBtn').on('click',function(){
var selectedForm = $('#formList').val();
if(selectedForm){
$('#'+ selectedForm).submit();
}
});
the example is also available as a jsfiddle:
https://jsfiddle.net/k1jf4b4L/
Hope it helps a bit

Paypal not prepopulating address details

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="notify_url" value="http://www.blaa.co.uk/ipn_subscribe.asp">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="blaaa#blaa.co.uk">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="return" value="http://www.blaablaa.co.uk/thankyou.asp?oid=955">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="item_name" value="Purchase">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="custom" value="955">
<input type="hidden" name="amount" value="85">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="address1" value="5 Birkin Close">
<input type="hidden" name="city" value="knutsford">
<input type="hidden" name="country" value="GB">
<INPUT id="email" type="hidden" name="email" value="test#test.com">
<INPUT type="image" name="Continue" src="NewImages/continue1.jpg" alt="Continue to payment merchant to pay for your purchase">
</FORM>
Any idea why this does pre populate the Adddress details if you do a credit card purchase?It looks fine to me.
The form is calling paypay - https://www.paypal.com/cgi-bin/webscr. The image is the button that sends the form to paypal. It is going to paypal and not prepopulating the address details in paypal if you want to pay by creditt card. Any ideas why please. Thanks
add this in your code it will work and also enable auto return ul option in your account in website payment prefrence under the selling prefrence under profile under my account option
<input type="hidden" name="return" value="http://abctest.com./purchase/thank-you.php">
(edit show code...)