|
|
|
|
|
|
![]() |
#1 |
Nobody gets into heaven without a glowstick
|
Help with PHP submit form
I'd like to create a submit from for my LL using PHP.
Can anyone direct me to a tutorial on this? |
![]() |
![]() |
![]() |
#2 |
You can now put whatever you want in this space :)
|
For forms, I usually create an HTML page with <form action=file.php method=post(or get)>
Then write in file.php: <?php $useremail = $_GET['email']; $title = $_GET['title']; $description = .... ?> Then either build an email message to myself or enter the info into a MYSQL DB (or both). Let me know if you were looking for more detailed info ![]()
__________________
Success is going from failure to failure without a loss of enthusiasm. |
![]() |
![]() |
![]() |
#3 |
Nobody gets into heaven without a glowstick
|
I think that's what I need, but I'm way behind on this PHP stuff, so that still looks really confusing to me. I'm going to go do some research on this and I'll be back tomorrow, hopefully further along
![]() I really appreciate the help! |
![]() |
![]() |
![]() |
#4 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
I usually prefer to use $_REQUEST['fieldname'] -- that way you don't have to worry about whether it is method="GET" or method="POST" in your form. And I prefer to use POST rather than GET anyhow.
then, you can insert the records into your database, or create an email that is mailed to you.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#5 | |
You can now put whatever you want in this space :)
|
Quote:
Ponyman, here's an example code you can test. If you want more info, just look it up at PHP.net (I'm sure you already know that url though). form.html: HTML Code:
<form method="post" action="eatthis.php"> Your Nick: <input name="name" type="text"><BR> Email Addres: <input name="email" type="text"><BR> Subject: <input name="subject" type="text"> Message:<textarea name="message" cols="50" rows="17"> <input name="Submit" type="submit" value="Send it baby!"> </form> PHP Code:
__________________
Success is going from failure to failure without a loss of enthusiasm. |
|
![]() |
![]() |
![]() |
#6 |
Nobody gets into heaven without a glowstick
|
Yo halfdeck, I tried that out and I couldn't get it to work. I click on the submit button and it looks like it's working, but I get no e-mail at all.
I found this php form for e-mail, but it looks even more complicated: http://www.alt-php-faq.org/local/48/#id48 |
![]() |
![]() |
![]() |
#7 |
Nobody gets into heaven without a glowstick
|
hmmm. the form works if I don't fill it out and just click submit, I geta a blank e-mail
here is the .php file <?php // Capture info sent from the form in variables $Title = $_REQUEST['Title:']; $URL = $_REQUEST['URL:']; $Category = $_REQUEST['Category']; $Type = $_REQUEST['Type']; $Comments = $_REQUEST['Comments']; $nickname = $_REQUEST['nickname']; $email = $_REQUEST['email']; // Print out one of the vars on the page just to make sure you got it echo "Thanks for submitting to The Sexwitch! You will receive an e-mail about your site once it has been reviewed. $message<BR>"; // Email it to myself mail('sexwitch@sexwitch.com', $Title, $URL, $Category, "From: $nickname ($email)\r\n"); ?> |
![]() |
![]() |
![]() |
#8 |
Shut up brain, or I'll stab you with a Q-tip!
|
$address = ''; //the address it will be sent to
$subject = ''; //the subject that will show up $email = ''; //the email-text $header = ''; //email-header mail($address,$subject,$email,$header); //this line sends the mail you used a wrong syntax in the mail-function mail('sexwitch@sexwitch.com', $Title, $URL, $Category, "From: $nickname ($email)\r\n"); you can't just add your variables and seperate them with a ',' The function needs the correct syntax.. find more here: http://www.php.net/manual/en/function.mail.php another mistake is "From: $nickname ($email)\r\n" .. this would put out exactly what you have .. rather try this: 'From: '.$nickname.'<br>Message: '.$email what this does: it takes the text 'From: ' and adds the content of the variable $nick to it. then another text and the content of $email.. remember to add dots inbetween them
__________________
Please Re-Read The Rules For Sig Files Last edited by pornoTGB; 2005-07-26 at 09:09 PM.. Reason: wrong url |
![]() |
![]() |
![]() |
#9 |
Nobody gets into heaven without a glowstick
|
This is what I've got so far
<?php // Capture info sent from the form in variables $Title = $_REQUEST['Title:']; $URL = $_REQUEST['URL:']; $Category = $_REQUEST['Category']; $Type = $_REQUEST['Type']; $Comments = $_REQUEST['Comments']; $nickname = $_REQUEST['nickname']; $email = $_REQUEST['email']; // Print out one of the vars on the page just to make sure you got it echo "Thanks for submitting to The Sexwitch! You will receive an e-mail about your site once it has been reviewed. $message<BR>"; // The message $message = "Line 1\nLine 2\nLine 3"; // Email it to myself $message = "$Title\n$URL\n$Category"; $address = ' sexwitch@sexwitch.com'; $subject = 'Sexwitch Submit'; $email = ' blank'; $header = ' sexwitch@sexwitch.com'; mail($address,$subject,$email,$header,$message); ?> It sends an e-mail with headers with the word "blank" in the body. Now I can't figure how to add the captured text from the form into the email. |
![]() |
![]() |
![]() |
#10 |
You can now put whatever you want in this space :)
|
Like PornoTGB pointed out, you have to stick to this basic syntax:
mail($targetemail, $subject, $message); Example: mail("paulazahn@cnn.com","Re:Nice interview last night", "Hey Paula, just saw your interview with the girl working for New York Confidential...."); If you want to add header info, then like on the example on http://us2.php.net/manual/en/function.mail.php, use: mail($targetemail, $subject, $message, $header). In other words, mail($subject, $target_email, $header...) or any other variants like mail($header, $subject, $to_email) ... will not work.
__________________
Success is going from failure to failure without a loss of enthusiasm. |
![]() |
![]() |
![]() |
#11 |
Nobody gets into heaven without a glowstick
|
Ok, I think I finally got my SUBMIT FORM working. If anyone wants to submit some no recip required sites to help me further test the form, please go ahead, I'll list them.
http://www.sexwitch.com/webmasters.html |
![]() |
![]() |
![]() |
#12 | |
Kids are great, Appu. You can teach them to hate the things you hate and they practically raise themselves now-a-days, you know, with the internet and all
Join Date: Mar 2005
Location: Canadeh
Posts: 197
|
i submitted and got this reply.
Quote:
|
|
![]() |
![]() |
![]() |
#13 |
Nobody gets into heaven without a glowstick
|
Thanks Doug E, People's submits seem to be working fine now.
![]() |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|