FormMail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ackehallgren
Forum Newbie
Posts: 2
Joined: Thu Sep 15, 2005 5:39 am

FormMail

Post by ackehallgren »

Hi everyone, I just became a member.
I have a really annoying problem, and am quite frankly a newbie at everything php related.

I need a formmail, containing a lot of forms to fill in. And! I need the actual email to come up as

Name:
(form)

Job:
(form)

With big and small letters, and I haven't seen any form that is able to do this.
I also need it to be kinda simple, since I have no experience at it at all.
I've tried almost everything.

Any help at all is very appreciated!
Thanks.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

you want someone to write this for you? if so this is the wrong forum. if you want help them take a look at the mail() function in the php manual http://www.php.net

that will start you off as to how to send a email. the form part is simple html, just google for how to do html forms and you will find about a billion things.

what have you tried already? show us some code possibly and we can help you build on that
ackehallgren
Forum Newbie
Posts: 2
Joined: Thu Sep 15, 2005 5:39 am

Post by ackehallgren »

feyd | Yar, start posting code in

Code: Select all

and

Code: Select all

tags or not at all. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


This is the easiest and best one which gets me what I want, however, I only get the email every third time or so and I have no idea why:

Code: Select all

<html>
    <head>
        <title>Mailformulär</title>
    </head>
    <body>
    <?php
        if (!$Submit){
    ?>
        <form name="form1" method="post" action="formmail.php">
            <input type="text" name="fornamn" value="Skriv förnamn">
            <input type="text" name="efternamn" value="Skriv efternamn">
            <input type="text" name="rubrik" value="Skriv rubik på mail">
  <input type="text" name="skola" value="Skolan i &Ouml;rkeljunga">
  <input type="submit" name="Submit" value="Skicka">
            <input type="reset" name="Submit2" value="Rensa">
				    <?php
        } else {
            $mailadress = "ackehallgren@hotmail.com";
            mail("$mailadress", "$rubrik",
            "Namn:\n$fornamn $efternamn
			
		Skola:\n$skola");
            echo "http://www.personaldirekt.se";
        }
    ?>
        </form>
    </body>
</html>

(some words are in swedish, since it will be a swedish form.)


feyd | Yar, start posting code in

Code: Select all

and

Code: Select all

tags or not at all. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

ppplease use the php and code tags when posting code in the forum. they are right above the box that you type your message in, they are clearly labled and easy to use.

but for your problem, check your junk mail. you might be getting them shipped into there. if so you can either change your junk mail settings to always allow from that host (your website) or you can use the right headers (search this forum for junk email or somthing simmilar)
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

i just made a working form for you real quick with the same stuff you put on yours.

Form Script :arrow:

Code: Select all

<html> 
    <head> 
        <title>Mailformulär</title> 
    </head> 
    <body> 
        <form name="form1" method="post" action="process.php"> 
            <input type="text" name="fornamn" value="Skriv förnamn"> 
            <input type="text" name="efternamn" value="Skriv efternamn"> 
            <input type="text" name="rubrik" value="Skriv rubik på mail"> 
  <input type="text" name="skola" value="Skolan i &Ouml;rkeljunga"> 
  <input type="submit" name="Submit" value="Skicka"> 
            <input type="reset" name="Submit2" value="Rensa"> 
                   
        </form> 
    </body> 
</html>
 
process.php :arrow:

Code: Select all

<?

function generateEmail($fornamn, $efternamn, $rubrik, $skola)


{

return "
$fornamn 

$efternamn

$rubrik

$skola
";



}



// ..........



mail("ackehallgren@hotmail.com","Stampin Queen Order Form", generateEmail($fornamn, $efternamn, $rubrik, $skola), "Content-type: text/html\r\n"); 
?>
<html>

<form name="redirect">
<center>
<font face="Arial"><b>You will be redirected in:<br><br>
<form>
<input type="text" size="3" name="redirect2">
</form>
seconds</b></font>
</center>

<script>
<!--



//change below target URL to your own
var targetURL="http://www.personaldirekt.se"
//change the second to start counting down from
var countdownfrom=3


var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){

if (currentsecond!=1){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
window.location=targetURL
return
}
setTimeout("countredirect()",1000)
}

countredirect()
//-->
</script>
</html>
the process.php and the form script need to be in the same folder to work unless you change the path to it. also the processor redirects you to http://www.personaldirekt.se

good luck
Post Reply