-1

I have an html forum with 3 fields Naam Achternaam Email

After the user fills in the forum and clicks submit, it wil call a php script called action_page.php.

Taht script should be posting back to the screen the given information form the html forum.

At this point it only gives back 3 NULL values

Naam: Achternaam: Email: This is the html code

how can i get the PHP script to take the filled in fields from the html page and show then on screen.

<?php    
// what post fields?
$fields = array(
   'Naam' => $Naam,
   'Achternaam' => $Achternaam,
   'Email' => $Email,
);

// build the urlencoded data
$postvars = http_build_query($fields);

// open connection
$ch = curl_init();

// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);

// execute post
$result = curl_exec($ch);

// close connection
curl_close($ch);
?>

This is the php code

The html page has 3 fields

<html>
<body>

<form action="/action_page.php" method="post">
  Naam: <input type="text"name="Namm"><br>
  Achternaam: <input type="text" name="Achternaam"><br>
  Email: <input type="text" name="Email"><br>

 <td><input type='submit' name='post' value='post'></td>
<td><input type='reset' name='Rest' value='Reset'></td>
</form>


</body>
</html>

but after i click op sumbit the action_page returns a blank page or for each filled field it echo NULL on the screen.

What i am trying to make is an php page that prints the 3 filled field from the html page that should post them to the php page so that can print them to the screen.

am i dooing something wrong here or mistyped in the code some where?

sojab0on
  • 1
  • 4

1 Answers1

1

Not sure if this is what you are looking for, but to get posted values, you'll use the $_POST superglobal

$fields = array(
    'Naam' => $_POST["Naam"],
    'Achternaam' => $_POST["Achternaam"],
    'Email' => $_POST["Email"],
);
baao
  • 71,625
  • 17
  • 143
  • 203