Jump to content


Photo

Form Scripting


  • Please log in to reply
21 replies to this topic

#1 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 13 March 2008 - 09:03 PM

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...te/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
jtsysbcu

aka: Brenda
Say, Hey! It's a good day!

#2 TCH-Andy

TCH-Andy

    Immediate Family

  • Members
  • PipPipPipPip
  • 4,699 posts

Posted 14 March 2008 - 03:47 AM

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 ?
Andy Beckett
-----------------
Part of the TCH family since the beginnings of time.

#3 OJB

OJB

    Immediate Family

  • Members
  • PipPipPipPip
  • 364 posts

Posted 14 March 2008 - 06:06 AM

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, 14 March 2008 - 06:12 AM.


#4 TCH-Bruce

TCH-Bruce

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 19,960 posts

Posted 14 March 2008 - 07:19 AM

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.

Bruce Richards
Forum Moderator
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum

I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.


#5 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 14 March 2008 - 10:07 PM

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!

Attached Files


jtsysbcu

aka: Brenda
Say, Hey! It's a good day!

#6 TCH-Andy

TCH-Andy

    Immediate Family

  • Members
  • PipPipPipPip
  • 4,699 posts

Posted 15 March 2008 - 04:25 AM

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.
Andy Beckett
-----------------
Part of the TCH family since the beginnings of time.

#7 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 15 March 2008 - 09:41 AM

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

aka: Brenda
Say, Hey! It's a good day!

#8 TCH-Bruce

TCH-Bruce

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 19,960 posts

Posted 15 March 2008 - 09:44 AM

You leave the hostname as localhost and the port at 3306

Bruce Richards
Forum Moderator
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum

I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.


#9 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 15 March 2008 - 09:57 AM

You leave the hostname as localhost and the port at 3306


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

Attached Files


jtsysbcu

aka: Brenda
Say, Hey! It's a good day!

#10 TCH-Bruce

TCH-Bruce

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 19,960 posts

Posted 15 March 2008 - 10:03 AM

The username, filename and tablename are all incorrect.

They should not contain cpanel

Bruce Richards
Forum Moderator
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum

I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.


#11 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 15 March 2008 - 10:05 AM

The username, filename and tablename are all incorrect.

They should not contain cpanel



still getting the error. :)
jtsysbcu

aka: Brenda
Say, Hey! It's a good day!

#12 TCH-Bruce

TCH-Bruce

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 19,960 posts

Posted 15 March 2008 - 10:10 AM

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

Bruce Richards
Forum Moderator
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum

I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.


#13 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 15 March 2008 - 10:12 AM

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



From the connect button on the php form wizard.
jtsysbcu

aka: Brenda
Say, Hey! It's a good day!

#14 TCH-Bruce

TCH-Bruce

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 19,960 posts

Posted 15 March 2008 - 10:20 AM

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?

Bruce Richards
Forum Moderator
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum

I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.


#15 TCH-Thomas

TCH-Thomas

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 14,908 posts

Posted 15 March 2008 - 10:40 AM

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.

Thomas Jikrantz
Forum Moderator
TotalChoice Hosting, Inc.

Any links or suggestions for third party software/sites should be used at your own risk. My opinions and recommendations are not necessary those of TCH and TCH is not responsible.

As a Forum Moderator I can assist in answering many of your hosting related questions. However, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.
Web Hosting by Total Choice Web Hosting - 24/7 Help Desk


#16 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 15 March 2008 - 10:44 AM

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

aka: Brenda
Say, Hey! It's a good day!

#17 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 15 March 2008 - 10:50 AM

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

aka: Brenda
Say, Hey! It's a good day!

#18 TCH-Andy

TCH-Andy

    Immediate Family

  • Members
  • PipPipPipPip
  • 4,699 posts

Posted 15 March 2008 - 11:41 AM

Is this program for Linux or Windows ? with a program like setup.exe it sounds as if it's a windows program.
Andy Beckett
-----------------
Part of the TCH family since the beginnings of time.

#19 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 16 March 2008 - 12:47 PM

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

aka: Brenda
Say, Hey! It's a good day!

#20 TCH-Bruce

TCH-Bruce

    Volunteer Moderator

  • Members
  • PipPipPipPip
  • 19,960 posts

Posted 16 March 2008 - 01:07 PM

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.

Bruce Richards
Forum Moderator
TotalChoice Hosting, Inc.
Webhosting by Total Choice Web Hosting - General Support Forum

I am a Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.


#21 TCH-Andy

TCH-Andy

    Immediate Family

  • Members
  • PipPipPipPip
  • 4,699 posts

Posted 16 March 2008 - 01:13 PM

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 :)
Andy Beckett
-----------------
Part of the TCH family since the beginnings of time.

#22 jtsysbcu

jtsysbcu

    New To The Neighborhood

  • Members
  • Pip
  • 21 posts

Posted 16 March 2008 - 07:51 PM

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:
jtsysbcu

aka: Brenda
Say, Hey! It's a good day!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users