-1

trying to use the forn element in html. wrote a simple form, and a simple php page, but every time i hit the submit a blank page is appearing nomatter what im doing in the php:

my html form:

<form id="contact-main-form"  method="post" action="process.php">
<input id="contact-small-last-name-textbox"name="lastName" 
  type="text" placeholder="last name">
<input id="submit" type="submit" value="send">
</form>

my php page :

<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <?php
    echo $firstName ;
    print "hello";
    ?>
</body>

thank you ;

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
liadd
  • 41
  • 2
  • 10

1 Answers1

2

In PHP data from some scopes are available with super globals. For forms you will use the super global $_POST.

In your example your "lastName" field content will be in :

$lastName = $_POST['lastName'];

Some docs about that : http://php.net/manual/en/language.variables.superglobals.php

Michaël Garrez
  • 408
  • 2
  • 9
  • 1
    Indeed. Assuming they're not using the same file for both HTML/PHP. Otherwise, they'd get an undefined index notice. Best to check for empty'ness / if set. `!empty()` is better though. – Funk Forty Niner Sep 03 '15 at 16:17
  • how i check my log ? what does it mean ? @Fred-ii- – liadd Sep 03 '15 at 16:32