user2658838
user2658838

Reputation: 80

PHP post data to an HTTPS page

I have a https page named user.php that gets data and posts it to another receiving.php https page. My problems is whenever I submit my data for posting the receiving.php displays server error. I have read articles about cURL but I don't have a clear picture of the syntax.

user.php

<form action="https://www.mydomain.com/ssl/receiving.php"> 
<input type="text" name="variable" />
<input type="submit" name="buttonName" />
</form>

receving.php

if(isset($_POST["buttonName"]))
{
$variable=$_POST['variable'];

}

Upvotes: 1

Views: 1900

Answers (3)

Drixson Ose&#241;a
Drixson Ose&#241;a

Reputation: 3641

<form action="https://www.mydomain.com/ssl/receiving.php">

if you want to use $_POST you need to make your form method set to method="POST" or by default your method form is using "GET".

So you instead of using $_POST , you need to use $_GET in your case.

Upvotes: 0

Dante Ditan
Dante Ditan

Reputation: 34

you need to use the $_GET method instead of $_POST because $_GET is a method that displays your request in the form in URL. while $_POST for security reason is just getting data from the form and not displaying the actions you've requested.

Upvotes: 0

George Yates
George Yates

Reputation: 1247

You want to add method="POST" to your form tag. By default it'll submit through GET. If that doesn't work, try var_dump($_POST) in receiving.php to see exactly what's coming through. cURL is mainly for when you want a script to make a request to a server on its own. A form submit shouldn't need to worry about cURL.

What error are you receiving though? This shouldn't display an error as your isset() should just return false.

Upvotes: 2

Related Questions