PDA

View Full Version : php web form - I need one please!



Exolution
25-06-2006, 10:16 AM
I need a php webform, not an HTML one because they suck and open windows outlook.

I want one of those ones that sends it to an email. A php one, if anybody would be so kind as to post the code for one here. :D

Why don't I make one myself? I don't know php.

Thanks, +rep if you do (when I get some rep power. :rolleyes:)

ebay
25-06-2006, 11:23 AM
Rite first make a page called form.php
add this to that page and save it


<form action="contact_gene.php" method="post">
<input type="text" size="25" value="Name" name="name">
<br>
<br>
<input type="text" size="25" value="Your email" name="email">
<br>
<br><select size="1" name="option">
<option value="Page Error">Page Error</option>
<option value="FeedBack">FeedBack</option>
<option value="General Contact">General Contact</option>
<option value="User System Problem">User System Problem</option>
<option value="-Please Choose One-" selected="selected">-Please Choose One-</option></select>
<br>
<br><textarea name="message" rows="10" cols="43"> </textarea>
<br>
<br>
<input type="hidden" value="<? $ip = getenv('REMOTE_ADDR'); PRINT("$ip"); ?>" name="ip">
<br>
<br>
<input type="submit" value="Submit" name="submit"> </form></p></td>


Next create a page that sends the dat to an email address, call this page contact_gene.php


<?php
if ($_SERVER['REQUEST_METHOD'] != 'GET'){
$name = $_POST['name'];
$email = $_POST['email'];
$option = $_POST['option'];
$mess = $_POST['message'];
$ip = $_POST['ip'];
$messig = "

Name: $name
\n
Email: $email
\n
Option: $option
\n
message: $mess
\n
ip: $ip
\n
";
$subject = $option;
mail("Your email here!", $subject, $messig);
Header("Location: index.php");
}
else
{
echo 'ERROR';
}
?>
[/cphp]

This part of the generator gets the info entered to the form:

[php]
<?php
if ($_SERVER['REQUEST_METHOD'] != 'GET'){
$name = $_POST['name'];
$email = $_POST['email'];
$option = $_POST['option'];
$mess = $_POST['message'];
$ip = $_POST['ip'];
$messig = "


And this bit passes the info on to be sent to your email!


Name: $name
\n
Email: $email
\n
Option: $option
\n
message: $mess
\n
ip: $ip
\n

lastly create a page and put this simple code in that sends the visitor to a selected page once they have sent the form


$subject = $option;
mail("Your email here!", $subject, $messig);
Header("Location: index.php");
}
else
{
echo 'ERROR';
}
?>


any problems contact me

Exolution
25-06-2006, 01:09 PM
Hey dude.

Thanks very much! +REP

I need to know where to put
Name: $name
\n
Email: $email
\n
Option: $option
\n
message: $mess
\n
ip: $ip
\n

And, how would I make it so it fits onto the page (like in the box)..

Thank you :)

ebay
25-06-2006, 01:13 PM
u put it in the contact_gene.php page, soz it didnt work for some reason, and thanks for the +rep,

Exolution
25-06-2006, 01:20 PM
Do I put the last three codes in one page?

ebay
25-06-2006, 01:39 PM
yer i think

nick12
25-06-2006, 03:31 PM
http://www.nhosting.net/nickform.zip (http://www.nhosting.net/nickform.zip)

here premade

ebay
25-06-2006, 05:12 PM
very good nick * bravo *

nick12
25-06-2006, 05:13 PM
:) thanks mate

Flisker
28-06-2006, 05:43 AM
Nick its not there lol, Error 404

Want to hide these adverts? Register an account for free!