Jump to content

Recommended Posts

so for the script.php, this is what i would enter?:

SMTP mail()
smtp_port
sendmail_from
sendmail_path

Is that all that is required, or is there more to it. Also how would i turn it into the correct format of a script.. sorry i'm new to php codes. Can someone give examples of how it should look like?
Link to comment
https://forums.phpfreaks.com/topic/11944-forms/#findComment-45337
Share on other sites

No, but this shoud extract all data sent to the script and send it to your email:

[code]<?php

$to = 'youremail@yourdomain.com';
$subject = 'This is a message';
$message = "Message : \n\n";

foreach ($_POST as $key => $value) {
   $message .= $key . ': ' . $value . "\n";
}

mail($to, $subject, $message);

?>[/code]

Obviously you need:

[code]<form action="script.php" method="post">[/code]
Link to comment
https://forums.phpfreaks.com/topic/11944-forms/#findComment-45339
Share on other sites

Thanks you very much, i got it work now.

And one more question(for now that is [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] )
How can i make it redirect to another page, since it becomes blank after submitting it.
Link to comment
https://forums.phpfreaks.com/topic/11944-forms/#findComment-45349
Share on other sites

After mail($to, $subject, $message); you can add a Location header:

[code]header("Location: http://www.sompage.com");[/code]

Or a link:

[code]echo 'Email Sent!<br />
<a href="somepage.htm">Redirect</a>';[/code]

Or even display a page:

[code]echo file_get_contents('somepage.htm');[/code]
Link to comment
https://forums.phpfreaks.com/topic/11944-forms/#findComment-45353
Share on other sites

you would make if statements on the posted variables, like

if (isset($_POST['blah'] && $_POST['blah'] != ' ' && is_numeric($_POST['blah'])) {
.
.
}

although with age, you might do better to have a dropdown box. that way the user can only select pre-formatted values. that is, they would HAVE to choose 1-100 or whatever, instead of entering in lkasf for age.
Link to comment
https://forums.phpfreaks.com/topic/11944-forms/#findComment-45392
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.