jtsysbcu Posted March 14, 2008 Posted March 14, 2008 Can someone please help me? I am working on my website and cannot seem to get my form to submit the form via email or database upload. I need to get this done, as I've been working on it for a couple of weeks with no avail. If anyone can help with scripting, I'd really appreciate it. http://www.lincolnms.com/Lincoln%20MS%20Website/MS_Walk.html The way it is set up now, when you click the submit button, it brings up an email (blank). That's not really what I want. Last year I had it set up to send email and it worked just fine with the form fields showing in the email. But through having to revamp for a new year's Walk, I've lost my coding and I cannot for the life of me figure this out. Please advise. Quote
TCH-Andy Posted March 14, 2008 Posted March 14, 2008 In the code, where you have defined 'form action="mailto.....' you need to set the action to run some mailing script on your account. Do you have a mailing script to process the form ? Quote
OJB Posted March 14, 2008 Posted March 14, 2008 (edited) As Andy said you will either need to get or write a PHP script to send you the emails and then in your form have it say: <form action="yourphpmailerscript.php" name="Register" id="Register" action ="post"> the PHP script itself can probably be pretty simple... a foreach to run through your $_POST array and appending this into the body section of your email... something similar to this: ><?php if(isset($_POST['Submit'] && !empty($_POST)) { $body = ''; foreach($_POST as $key => $val) { if($key != 'Submit') { $body .= $key . ' - ' . $val.'\n\r'; } } $to = 'YOUREMAIL@GOES.HERE'; $subject = 'Registration at Lincoln MS Website'; $from = "From: " .$_POST['E-mail2']; mail($to, $subject, $body, $from); } ?> Bare in mind this will be a very basic email. it will also do no checks to ensure everything is filled out correctly. It will just send the name of the particular form field, followed by the value entered. It also will not stop bots from submitting your form and sending you emails. If you want to put it into a DB you will have to make sure that sanitize all input from possible SQL-Injection and other filthy things... but thats more complicated Edited March 14, 2008 by OJB Quote
TCH-Bruce Posted March 14, 2008 Posted March 14, 2008 As both Andy and OJB have said you need a form processing script to handle the information. Please make sure your script is secure. If your script is compromised to send spam email you are responsible. You can check hotscripts.com for a secure form processing script. Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 Thanks everyone! Now I have another question. I am using PHP Form Wizard to assist with my form submission. I need some information for the scripting. I've attached a screen shot of the wizard. I need to know the host name and port and I'll be set with my form! Please advise. And thanks in advance for your assistance! I really appreciate it! Quote
TCH-Andy Posted March 15, 2008 Posted March 15, 2008 You first need to create a database in cpanel Then create a user for the database in cpanel, Then assign that user to that database. The data you then have is correct apart from the database, username & password. The database will be in the format cpanelusername_dbname The username will be in the format cpanelusername_username The password will be whatever you set it to when you created it in cpanel. Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 You first need to create a database in cpanelThen create a user for the database in cpanel, Then assign that user to that database. The data you then have is correct apart from the database, username & password. The database will be in the format cpanelusername_dbname The username will be in the format cpanelusername_username The password will be whatever you set it to when you created it in cpanel. What do I enter for the host name? What do I enter for the port? the help section of php form wizard said to contact the hosting company for this information. Quote
TCH-Bruce Posted March 15, 2008 Posted March 15, 2008 You leave the hostname as localhost and the port at 3306 Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 You leave the hostname as localhost and the port at 3306 Okay, I did that and I'm getting the following error. see attachment. ???? Quote
TCH-Bruce Posted March 15, 2008 Posted March 15, 2008 The username, filename and tablename are all incorrect. They should not contain cpanel Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 The username, filename and tablename are all incorrect. They should not contain cpanel still getting the error. Quote
TCH-Bruce Posted March 15, 2008 Posted March 15, 2008 How are you testing this? From your website or on your PC? Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 How are you testing this? From your website or on your PC? From the connect button on the php form wizard. Quote
TCH-Bruce Posted March 15, 2008 Posted March 15, 2008 Sorry, I have never used this product, but "localhost" and port "3306" are correct. Does the company you got the form wizard program from offer any help? Quote
TCH-Thomas Posted March 15, 2008 Posted March 15, 2008 In the screenshot it seems that "Brenda" is with a uppercase B, linux is case sensitive so please try with lowercase on all letters and see what happens. Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 In the screenshot it seems that "Brenda" is with a uppercase B, linux is case sensitive so please try with lowercase on all letters and see what happens. that didn't work either. Quote
jtsysbcu Posted March 15, 2008 Author Posted March 15, 2008 In the screenshot it seems that "Brenda" is with a uppercase B, linux is case sensitive so please try with lowercase on all letters and see what happens. In the help menu on php form wizard, "Please note that if you want the wizard to create the MySQL Table in which you want to save the submitted data please run the script setup.exe once on yourserver ." How do I run the setup.exe on the server?? Quote
TCH-Andy Posted March 15, 2008 Posted March 15, 2008 Is this program for Linux or Windows ? with a program like setup.exe it sounds as if it's a windows program. Quote
jtsysbcu Posted March 16, 2008 Author Posted March 16, 2008 Is this program for Linux or Windows ? with a program like setup.exe it sounds as if it's a windows program. Okay, I've given up on the database thing for now. I have to get this ready so I can use it for our registrations. Now when I submit a form - just to have the user send an email, I get this error on the web. Warning: fopen(2008_Walk_Registrations.txt) [function.fopen]: failed to open stream: Permission denied in /home/jtsysbcu/public_html/Lincoln MS Website/index.php on line 151 Cannot open file (2008_Walk_Registrations.txt) However, the form is submitted via email and the confirmation email sent to the user. I cannot have this error page come up as the registrant will think that their registration didn't go through. Please advise. (There must be a coding problem somewhere, but I'm not sure how to fix it.) Any help is appreciated! Quote
TCH-Bruce Posted March 16, 2008 Posted March 16, 2008 Go into your cPanel and select the File Manager. Now go to the public_html folder and create that file and set it's permissions to 666 which will allow the server to write to the file. Quote
TCH-Andy Posted March 16, 2008 Posted March 16, 2008 I'd suggest creating the txt file in that directory and setting the permissions to 777 - then you shouldn't get an error. As a general comment, it's best not to use capital letters and spaces in files names / directories on the web ( since not everything handles them well ) just noticed Bruce beat me to it ... that will teach me to chat to others at the same time as replying Quote
jtsysbcu Posted March 17, 2008 Author Posted March 17, 2008 I'd suggest creating the txt file in that directory and setting the permissions to 777 - then you shouldn't get an error. As a general comment, it's best not to use capital letters and spaces in files names / directories on the web ( since not everything handles them well ) just noticed Bruce beat me to it ... that will teach me to chat to others at the same time as replying Thanks to everyone. I think I finally have it! And did I mention... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.