Thread: PHP Form help....
Results 1 to 15 of 30
Related
-
required form fields in php page using redirect.php form Forum: PHP Forum
Replies: 1 -
Disable/Enable form features based on form selections Forum: Javascript Forum
Replies: 4 -
Problem with form in IE6 - empty space at end of form Forum: HTML Forum
Replies: 1 -
Form Handling Script for 'Tell A Friend' Form Forum: Javascript Forum
Replies: 1 -
Want to have data in form appear elsewhere in same form Forum: HTML Forum
Replies: 3
-
04-17-2002, 04:24 PM #1
PHP Form help....
I'm really a n00b at this stuff and I'm not even the one who wrote the code for the form. My friend wrote it for our new site design but doesn't know how to make the form write to PHP instead of using default mail program like Outlook Express for me. This is the link: http://colorconcepts.ukterrorist.com/wip/contact (I know he told me he wants it to write to PHP but I'm not exactly sure why or what that involves.....so bear with me please) Thx in advance cause I know you all are so busy and have your own lives and problems to deal with.
-
04-17-2002, 04:43 PM #2
You need the <form action=" to point at a php script.
If you give me ten minutes, I'll post a generic email processor here.If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
04-17-2002, 05:04 PM #3
/me does a happy dance! Whooohoooo!
-
04-17-2002, 05:05 PM #4
Here we go, I have done a very strange processor, but it works. The advantage of the way I have code it is that you can point ANY form at this, and it will pick up the names of the inputs, and send them in an email. SO it doesn't matter how many fields you have in your form, as long as they have name="something" the emailer will send them -
PHP Code:<?
// Filename: mailer.php
// Generic Emailer
// Default Settings
$recipient = "dean@somepeople.net";
$redirect = "My_thank_you_page.html";
// First, detects whether info is received via form -
$subject = "Email From my Website";
$from = "From: My Website Emailer";
$email = "
";
$data = $HTTP_POST_VARS;
foreach($data as $k => $v) {
$k = stripcslashes($k);
$v = stripcslashes($v);
$email .= "\n$k : $v";
}
mail($recipient, $subject, $email, $from);
header("Location: $redirect");
?>
Code:<html> <head> <TITLE>COLOR Concepts - Your Source For Digital Artwork - [CONTACT]</TITLE> <style type="text/css"> <!-- BODY, TABLE, DIV, P a { font: 7pt verdana; color: #000000; text-decoration: none; } a:link { color: #CCCCCC; text-decoration: none;} a:active { color: #000000; text-decoration: underline; } a:visited { color: #CCCCCC; text-decoration: none } a:hover { color: #000000; text-decoration: underline; } BODY {scrollbar-3d-light-color:#171582; scrollbar-arrow-color:#FFFFFF; scrollbar-base-color:#FFFFFF; scrollbar-dark-shadow-color:#000000; scrollbar-face-color:#000000; scrollbar-highlight-color:#FFFFFF; scrollbar-shadow-color:#000000} --> </style> </head> <body> <center> <form action="mailer.php" method="post"> Name: <input type="text" name="Name"> Email: <input type="text" name="Email"> <br> Message: <br> <textarea rows="10" cols="45" name="content"> ::Place your msg here:: </textarea> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </form> </center> </body> </html>
Last edited by QuietDean; 11-11-2003 at 06:10 AM.
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
04-17-2002, 05:20 PM #5
Ok thx, this should do nicely.....yet I have no idea what to do now. I'm guessing to copy all the script code into a file and name it mailer.php? then use your modified code for the page code and it should work? This heat is killing me......thx so far though.
-
04-17-2002, 05:25 PM #6
Thats exactly right. The only thing to watch is, when you paste in the code for mailer.php, make sure that the <? is the VERY first character in the file. No white space, no line break. It will still work, but it will give an error and fail to redirect otherwise.
Dont worry about adding for form fields, it can handle any amount. Also, avoid the 'enctype' declaration, seems to muck up the HTTP_POST_VARS , and you get an empty email.If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
04-17-2002, 06:11 PM #7
Ok I got everything pretty much setup, but I'd like to tweak it a bit. Here is what I have for the HTML Code:
Code:<html> <head> <TITLE>COLOR Concepts - Your Source For Digital Artwork - [CONTACT]</TITLE> <style type="text/css"> <!-- BODY, TABLE, DIV, P a { font: 7pt verdana; color: #000000; text-decoration: none; } a:link { color: #CCCCCC; text-decoration: none;} a:active { color: #000000; text-decoration: underline; } a:visited { color: #CCCCCC; text-decoration: none } a:hover { color: #000000; text-decoration: underline; } BODY {scrollbar-3d-light-color:#171582; scrollbar-arrow-color:#FFFFFF; scrollbar-base-color:#FFFFFF; scrollbar-dark-shadow-color:#000000; scrollbar-face-color:#000000; scrollbar-highlight-color:#FFFFFF; scrollbar-shadow-color:#000000} --> </style> <script language="javascript" type="text/javascript" src="chromeless.js"></script> <script language="javascript"> function openIT(u,W,H,X,Y,n) { var cD ='images/close.gif' var cU ='images/close.gif' var cO ='images/close.gif' var cL var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>' var tW ='COLOR Concepts' var wB ='#000000' var wBs ='#000000' var wBG ='#FFFFFF' var wBGs='#FFFFFF' var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0' var fSO ='scrolling=no noresize' chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO) } </script> </head> <body> <center> <form action="mailer.php" method="post"> Name: <input type="text" name="Name"> Email: <input type="text" name="Email"> <br> Message: <br> <textarea rows="10" cols="45" name="content"> ::Place your msg here:: </textarea> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </form> </center> </body> </html>
PHP Code:<?
// Filename: mailer.php
// Generic Emailer
// Default Settings
$recipient = "dave@colorconceptsdesign.com";
$redirect = "thankyou.html";
// First, detects whether info is received via form -
$subject = "Contact Message";
$from = "From: COLOR Concepts Design Contact Form";
$email = "
";
$data = $HTTP_POST_VARS;
foreach($data as $k => $v) {
$k = stripcslashes($k);
$v = stripcslashes($v);
$email .= "\n$k : $v";
}
mail($recipient, $subject, $email, $from);
header("Location: $redirect");
?>
Code:javascript:openIT('thankyou.html',200,200,null,null,'thankyou');
-DaveLast edited by Mr. Blue; 04-17-2002 at 06:14 PM.
-
04-17-2002, 08:27 PM #8
why don't you just do something like this:
PHP Code:<?php
// Filename: mailer.php
// Generic Emailer
// Default Settings
$recipient = "dave@colorconceptsdesign.com";
// First, detects whether info is received via form -
$subject = "Contact Message";
$from = "From: COLOR Concepts Design Contact Form";
$email = "
";
$data = $HTTP_POST_VARS;
foreach($data as $k => $v) {
$k = stripcslashes($k);
$v = stripcslashes($v);
$email .= "\n$k : $v";
}
mail($recipient, $subject, $email, $from);
echo "Thank you for e-mailing me. I will reply to your e-mail as soon as possible. Click <a href='index.html'>Here</a> to return to home page.";
?>
-
04-18-2002, 10:53 AM #9
I'm discussing it here because Dave made a post about the large number of PMs and I feel that it could benefit others that are new to the whole PHP thing like I am. I'm at school right now so I can't test out the new mailer.php but the way the new page is setup It'd be ideal if instead of going to a whole new page after submitting, it popped up the thankyou message in a javascript popup and cleared the form as well. That is what I'd like to do if anyone can help or if that's even possible. Also what about when the mail is sent to me....can I take what they input in the form at the "Email" field and have that put as the sender when I recieve it?
**EDIT** I already have a Borderless window javascript that I use on the other parts of my website, I just need to figure out if It can be implemented this way.**/EDIT**Last edited by Mr. Blue; 04-18-2002 at 10:56 AM.
-
04-18-2002, 12:12 PM #10
It is possible to get this working with a popup, however, it will take some re-working of the code. I will give it some thought.
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
04-18-2002, 01:11 PM #11
Ok Dean I really appreciate it, I know how much new people with Photoshop etc. like it when I give them help so I thank you for taking your own time to work on my problems.
-The Other Dave
-
04-18-2002, 05:32 PM #12
bah now I get an error which goes like this...
Code:Parse error: parse error, expecting `','' or `';'' in /.../mailer.php on line 76
Oh yeah here's the code for the mailer.php
PHP Code:<html>
<head>
<TITLE>COLOR Concepts - Your Source For Digital Artwork - [Thank You!]</TITLE>
<style type="text/css">
<!-- BODY, TABLE, DIV, P
a { font: 7pt verdana ; color: #000000; text-decoration: none; }
a:link { color: #0000FF; text-decoration: none;}
a:active { color: #0000FF; text-decoration: underline; }
a:visited { color: #0000FF; text-decoration: none }
a:hover { color: #0000FF; text-decoration: underline; }
BODY {scrollbar-3d-light-color:#171582;
scrollbar-arrow-color:#FFFFFF;
scrollbar-base-color:#CCCCCC;
scrollbar-dark-shadow-color:#000000;
scrollbar-face-color:#CFCFCF;
scrollbar-highlight-color:#FFFFFF;
scrollbar-shadow-color:#000000}
-->
</style>
<script language="javascript" type="text/javascript" src="chromeless.js"></script>
<script language="javascript">
function openIT(u,W,H,X,Y,n) {
var cD ='images/close.gif'
var cU ='images/close.gif'
var cO ='images/close.gif'
var cL
var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>'
var tW ='COLOR Concepts'
var wB ='#000000'
var wBs ='#000000'
var wBG ='#FFFFFF'
var wBGs='#FFFFFF'
var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
var fSO ='scrolling=no noresize'
chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO)
}
</script>
</head>
<body>
<?php
// Filename: mailer.php
// Generic Emailer
// Default Settings
$recipient = "dave@colorconceptsdesign.com";
// First, detects whether info is received via form -
$subject = "Contact Message";
$from = "From: COLOR Concepts Design Contact Form";
$email = "
";
$data = $HTTP_POST_VARS;
foreach($data as $k => $v) {
$k = stripcslashes($k);
$v = stripcslashes($v);
$email .= "\n$k : $v";
}
mail($recipient, $subject, $email, $from);
echo "Thank You For Your Submission, You May Now Return To Viewing The Rest Of Our Site By Clicking <a href="news.php">Here</a>.";
?>
</body>
</html>Last edited by Mr. Blue; 04-18-2002 at 05:35 PM.
-
04-18-2002, 06:22 PM #13PHP Code:
echo "Thank You For Your Submission, You May Now Return To Viewing The Rest Of Our Site By Clicking <a href="news.php">Here</a>.";
-
04-18-2002, 07:04 PM #14
Hmmmmm, maybe I'm just not explaining myself correctly. This is the ideal situation that I'd like to happen:
[list=1][*]The website viewer clicks submit on the Contact Page Form[*]A popup window comes up with the thank you message in it[*]The Form is cleared[*]During this time the email has been sent[/list=1]
On the rest of my page I can use this JavaScript:
Code:<script language="javascript" type="text/javascript" src="chromeless.js"></script> <script language="javascript"> function openIT(u,W,H,X,Y,n) { var cD ='images/close.gif' var cU ='images/close.gif' var cO ='images/close.gif' var cL var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>' var tW ='COLOR Concepts' var wB ='#000000' var wBs ='#000000' var wBG ='#FFFFFF' var wBGs='#FFFFFF' var wNS ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0' var fSO ='scrolling=no noresize' chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wBG,wBGs,wNS,fSO) } </script>
Code:javascript:OpenIT('thankyou.html',200,200,null,null,'thankyou');
Last edited by Mr. Blue; 04-18-2002 at 07:22 PM.
-
04-18-2002, 10:54 PM #15
ok assuming that the form action is not for a different page, this should work:
PHP Code:<html>
<head>
</head>
<body>
<form method=POST action="mail.php"(assuming this current page is mail.php)>
Name: <input type="text" name="name">
Subject: <input type="text" name="subject">
E-mail: <input type="text" name="email">
<textarea name="message" cols=45></textarea>
<input type="Submit" value="Submit" name="submit">
</form>
<?php
strip_tags($name);
strip_tags($subject);
strip_tags($email);
strip_tags($message);
mail("webmaster@colorconcepts.com", "$subject", "
Name: $name\n
Message: $message\n", "From: Color Concepts Contact Form\nReply-to: $email\n");
if ($submit) {
echo "
<script language='javascript'>
<!--
alert('Thank you for contacting me. I will try to reply as soon as possible.')
-->
</script>";
}
?>
</body>
</html>
PHP Code:if ($submit) {
echo "
<script language='javascript' type='text/javascript' src='chromeless.js'></script>
<script language='javascript'>
function openIT(u,W,H,X,Y,n) {
var cD ='images/close.gif'
var cU ='images/close.gif'
var cO ='images/close.gif'
var cL
var tH ='<font face=arial size=1><b>.::COLORCONCEPTS::.</b></font>'
var tW ='COLOR Concepts'
var wB ='#000000'
var wBs ='#000000'
var wBG ='#FFFFFF'
var wBGs='#FFFFFF'
var wNS ='toolbar=0,location=0,directories=0,status=0,menu
bar=0,scrollbars=0,resizable=0'
var fSO ='scrolling=no noresize'
chromeless(u,n,W,H,X,Y,cD,cU,cO,cL,tH,tW,wB,wBs,wB
G,wBGs,wNS,fSO)
}
</script>
<body onload=javascript:OpenIT('thankyou.html',200,200,null,null,'thankyou')>
";
}
?>
</body>
</html>
sorry dean for rewriting the mail script but in order to get my brain workin with the rest of the page in the right direction I had to write the one I'm familiar with lol.Last edited by Derek; 04-18-2002 at 10:57 PM.
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum