Jump to content
Sign in to follow this  
Tarun

PHP

Recommended Posts

i have created one php file and html file and connected to each other.

But here i want a help reqards to php. Details mentioned below:

This is my HTML file:

<form method="post" action="contact.php">
    <textarea name="message"></textarea>
    <input type="submit">
</form>

 

This is my PHP file:

 

<?php
if($_POST["message"]) {
    mail("your@email.address", "Form to email message", $_POST["message"], "From: an@email.address");
}
?>

 

Here i want to know is if i want to add another textarea say it as name in HTML, so can you help me with the PHP coding, as i have tried with adding the another text area in PHP to retrieve data to my email, but i am not able to receive that.

Share this post


Link to post
Share on other sites

So the above is what works, show me what doesn't work.

You want an email field. You seem to have idea on how to start it, I want to see what you do with it.

Share this post


Link to post
Share on other sites

add this line to your form:

<input type="text" name="first_name">

and the first_name to your php message.  Remember the message is a string.

Edited by niche

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...