Jump to content

Recommended Posts

Posted

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. ;) :D

Posted

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 ?

Posted (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 by OJB
Posted

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.

Posted

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!

post-8301-1205550196_thumb.jpg

Posted

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.

Posted
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.

 

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.

Posted
You leave the hostname as localhost and the port at 3306

 

Okay, I did that and I'm getting the following error. see attachment. ????

post-8301-1205593017_thumb.jpg

Posted
The username, filename and tablename are all incorrect.

 

They should not contain cpanel

 

 

still getting the error. :)

Posted
How are you testing this? From your website or on your PC?

 

 

From the connect button on the php form wizard.

Posted
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. :)

Posted
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??

Posted
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!

Posted

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.

Posted

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 )

 

:lol: just noticed Bruce beat me to it ... that will teach me to chat to others at the same time as replying :)

Posted
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 )

 

:lol: 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! :tchrocks: :lol: :) :dance: And did I mention... :tchrocks: :thumbup:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...