FBML form issue

calamus

New Member
Hello all,

I'm a newbie to the forum, looking for some help.

I'm making a form for a business associate of mine and putting it on his facebook fan page.

Now i'm just fine on building the form and putting it on facebook, its up there and you can fill it in and everything, but i can't get it to email out.

I'll post the code,

<h1>Contact Us</h1>
<p>RANDOM GENERIC GREETING</p>
<form id="form1" name="form1" method="post" action="mailto:emailaddress">
<p>
<label for="name">Name:</label>
<input name="name" type="text" class="textInput" id="name" />
</p>
<p>
<label for="email">Email:</label>
<input name="email" type="text" class="textInput" id="email" />
</p>
<p>
<label for="comments">Comments:</label>
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</p>
<p><strong>What aspects of London most interest you?</strong></p>
<p class="chkRad">
<label>
<input type="checkbox" name="interests[]" value="Classical concerts" id="interests_0" />
Novice</label>
<br />
<label>
<input type="checkbox" name="interests[]" value="Rock/pop" id="interests_1" />
Peewee</label>
<br />
<label>
<input type="checkbox" name="interests[]" value="Drama" id="interests_2" />
Midget</label>
</p>
<p class="chkRad">
<label>
<input type="checkbox" name="interests[]" value="Walks" id="interests_3" />
Atom</label>
<br />
<label>
<input type="checkbox" name="interests[]" value="Art" id="interests_4" />
Bantam</label>
</p>
<p class="clearIt">
<input name="send" type="submit" id="send" value="Email Form" />
</p>
</form>

what am i doing wrong? i'm assuming it has to do with the action.

is there issues sending to webmail? i.e. gmail/yahoo/shawmail

am i just completely out to lunch?

please be gentle, i'm relatively new to the whole form thing.

thanks.
 

RoboticPro

New Member
well it's your action it is mailto:[email protected]
it has to point to a PHP file like this action="mailhandling.php"

in the mailhandling.php
you can set your variables and combine them in the mail you want then you can send it with this command

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

u just have to define those or you can do it like this

Code:
mail("[email protected]","Some subject","the message");

But what i would do is : (NOT TESTED)

Code:
<html>
<body>
<?php
//Check if form is submitted
if(isset($_POST['send'])){

    //Define variables

    $name = $_POST['name'];
    $email = $_POST['email'];
    $interests = $_POST['interests'];

    $to = "";
    $subject = "";
    $message = "My name is : ".$name."/n My email is : ".$email."/n My interest is : ".$interests."/n /n This was send from : Facebook";

    //Send mail

    if(mail($to,$subject,$message)){
        print"Thanks for your help"; //Thanks line
    }else{
        die(print "something went wrong"); //Some error message
    }
}else{
//Show your html form
?>
<h1>Contact Us</h1>
<p>RANDOM GENERIC GREETING</p>
<form id="form1" name="form1" method="post" action="thisfilename.php"> <!-- change this!!!!! -->
<p>
<label for="name">Name:</label>
<input name="name" type="text" class="textInput" id="name" />
</p>
<p>
<label for="email">Email:</label>
<input name="email" type="text" class="textInput" id="email" />
</p>
<p>
<label for="comments">Comments:</label>
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</p>
<p><strong>What aspects of London most interest you?</strong></p>
<p class="chkRad">
<label>
<input type="checkbox" name="interests" value="Classical concerts" id="interests_0" />
Novice</label>
<br />
<label>
<input type="checkbox" name="interests" value="Rock/pop" id="interests_1" />
Peewee</label>
<br />
<label>
<input type="checkbox" name="interests" value="Drama" id="interests_2" />
Midget</label>
</p>
<p class="chkRad">
<label>
<input type="checkbox" name="interests" value="Walks" id="interests_3" />
Atom</label>
<br />
<label>
<input type="checkbox" name="interests" value="Art" id="interests_4" />
Bantam</label>
</p>
<p class="clearIt">
<input name="send" type="submit" id="send" value="Email Form" />
</p>
</form>
<?php
}
?>
</body>
</html>
 
Last edited:
Top