Jump to content

Very basic form help.


Lee-Bartlett

Recommended Posts

Hi i just started to learn php and it is hard to say the least atm i got a basic form where i want to send the data in the feilds to my email adress.

 

the two forms are

 

(php form)

 

 

<htm>

<head>

 

<title>Untitled Document</title>

</head>

 

<body>

 

<?php 

$email = $HTTP_POST_VARS['[email protected]'];

$subject = $HTTP_POST_VARS['test'];

$message = $HTTP_POST_VARS['message'];

 

 

?>

 

</body>

</html>

 

and the form

 

<html>

<head>

 

<title>Untitled Document</title>

</head>

 

<body>

<form id="form1" name="form1" action="mail.php" method="post" >

  Name

  <label>

  <input type="text" name="Username" id="Username" />

  </label>

  <p>DOB

    <label>

    <input type="text" name="DOB" id="DOB" />

    </label>

  </p>

  <p>Age

    <label>

    <input type="text" name="AGE" id="AGE" />

    </label>

  </p>

  <p>

    <label for="button"></label>

    <input type="submit" name="button" id="button" value="Submit" />

  </p>

</form>

</body>

</html>

 

can someone please tell me where i might be going wrong or what i missed. (I found some code online and tried to implement it with mine)

Link to comment
https://forums.phpfreaks.com/topic/119637-very-basic-form-help/
Share on other sites

You're not actually mailing it anywhere, look at mail().

Also, avoid using $HTTP_POST_VARS, it is deprecated. Use $_POST instead.

 

Oh and looking at your PHP page, it's not making much sense. You don't actually call any of the variables in the form.

 

<?php
$email = "[email protected]";

//get post variables
$username = $_POST['Username'];
$dob = $_POST['DOB'];
$age = $_POST['AGE'];

//then put in your mail function
?>

Link to comment
https://forums.phpfreaks.com/topic/119637-very-basic-form-help/#findComment-616373
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.