Jump to content

Recommended Posts

I made a form using this, and it generated a really nice html form..

 

Unfortunately, it didn't make a php file to go along with it. I'm doing my best to understand this, but I'm having a lot of trouble locating the variables and text that I should actually be editing. Has anyone ever worked with phpforms.org before to send the form to email?

Link to comment
https://forums.phpfreaks.com/topic/183186-phpformorg/
Share on other sites

I made a form using this, and it generated a really nice html form..

 

Unfortunately, it didn't make a php file to go along with it. I'm doing my best to understand this, but I'm having a lot of trouble locating the variables and text that I should actually be editing. Has anyone ever worked with phpforms.org before to send the form to email?

 

It does what it says! PHP requires input, and those HTML forms give the text. Lets say in the <input method=post name="lastname">, had name="lastname". This would mean the following PHP code can access it:

 

$last_name = $_POST['lastname'];
echo $last_name;

 

But if you were to use it on the same page, you'd write:

(HTML form above php code..)
<?php
if (isset($_POST['lastname'])){
    $last_name = $_POST['lastname'];
    echo $last_name;
} else {
    echo "Warning, You haven't entered a last name!";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/183186-phpformorg/#findComment-966955
Share on other sites

Okay, I see. I was a bit confused by what it was actually doing for me. Thanks very much for your help.

 

I attached the form html I made with it. It makes a really neat form, but of course they ask you to pay for the php...

 

<form id="form_145479" class="appnitro"  method="post" action="emailthisstuff.php">
<input id="fname" name= "fname" class="element text" value=""/><label>First</label>
...
emailthisstuff.php:

<?php
if(isset($_POST['submit'])) {

$to = "you@you.com";
$subject = "Form info";
$fname_field = $_POST['fname'];
$lname_field = $_POST['lname'];

$body = "From: $fname_field $lname_field\n";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "Your message was not sent.";
}
?>

 

Will this pretty much send that data to the email? Will the echo be shown to the visitor? I appreciate any more input!

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/183186-phpformorg/#findComment-967083
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.