Passing placeholder value to a variable

0

Hi, I'm newbie and would like to know how I can pass the value of the placeholder to a variable ($ email)

<input type="text" class="form-control" placeholder="Email" = name=""/>
    
asked by anonymous 18.07.2017 / 23:03

1 answer

0

There are a few ways you can pass the value of your input .

As a beginner, I'll show you a very simple way. A default

<form action="serarquivo.php" method="post">
    <label for="email">Email</label>
    <input type="email" placeholder="email" name="email">    
</form>
  

In your serarquivo.php you get your variable according to the name attribute of your input

<?php
  $_email = $_POST['email'];
  echo "O e-mail recebido foi ".$_email; 
?>

There are a few ways to submit your form, which are:

  • GET: pass parameter through URL
  • POST: Pass parameter hidden (not URL)

Reference: link

    
19.07.2017 / 15:40