Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 07-10-2006, 10:07 PM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Question php help

I have two forms on my web page that iwould like to add php script to. I am having trouble doing this. Is it advisable to have two forms on one page or do I need to create a new page?


Kelly holidays.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 07-10-2006, 10:26 PM
Special Status
 
Join Date: Mar 2006
Location: Australia
Posts: 1,348
Default Re: php help

Kamoto,

You can have as many forms as you like on the one page. You must however pay attention to the following:

Make your form 'action' to point to the correct .php file.
If you want the same .php script to process both forms, you might require some .php scripting skills. If you are a beginner, I would suggest that you use 2 different .php files, each with a unique name.

Many will advice you to incorporate the php script into your landing page, I have a habbit of creating a php script file separte to the landing page.. either way, it should work fine.

Hope this helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 07-10-2006, 10:34 PM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Question Re: php help

Thanks ez-ez
I have two separate php scripts. I do not know where to save them. How do I do that to a web page already published? ( yes I am very much a beginner)

Thanks for any help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 07-10-2006, 10:48 PM
Special Status
 
Join Date: Mar 2006
Location: Australia
Posts: 1,348
Default Re: php help

The scripts must be uploaded onto the server just like any other page. Obviously, these files will appear in a .php format. For example: after you upload them, your folder can look like this:
form_1.htm
form_2.htm
script_1.php
script_2.php

It is prefered if you have the php scripts in the same folder as your form, in which case, you form action will be : script_file_name.php.. but if you have to upload the scripts on a different folder, make sure that your form action points to them. for example: folder/script_file_name.php.
That way you know that the form will send the data to that location (where the php script is) so it can be processed.
Once published, test the entire process to make sure it's working fine.
The fact that the 'form pages' are already published is irrelevant so long as the 'form' itself points to the script you are about to upload to the server.
Cheers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 07-10-2006, 10:49 PM
Special Status
 
Join Date: Mar 2006
Location: Australia
Posts: 1,348
Default Re: php help

Let me clarify one thing:

In your case, because your page contains the two form, after you upload your pages, your folder can look like this example:

form_page.htm
script_1.php
script_2.php

Those are only example names.. your file and script names should appear instead.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 07-10-2006, 10:56 PM
davidundalicia's Avatar
General & Forum Moderator
 
Join Date: Mar 2006
Location: Mallorca, Spain
Posts: 5,283
Default Re: php help

Good advice ez-ez
That should help others that may have wondered.......
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 07-10-2006, 10:59 PM
Special Status
 
Join Date: Mar 2006
Location: Australia
Posts: 1,348
Default Re: php help

Quote:
Originally Posted by davidundalicia
Good advice ez-ez
That should help others that may have wondered.......
Thank you sir..

I watch and learn from you guys.. so, many thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 07-11-2006, 12:03 AM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Default Re: php help

Where will I find the folder containing the forms? I have searched high and low and cannot find them. I must have lost the plot somewhere

Cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old 07-11-2006, 12:10 AM
Special Status
 
Join Date: Mar 2006
Location: Australia
Posts: 1,348
Default Re: php help

Look in the 'public_html' folder on the server.. If you have already published and viewed these forms before, they cant be anywhere else but there.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old 07-11-2006, 12:22 AM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Default Re: php help

I have looked and there are no forms there,

My web site is www.kellyholidays.com

The forms are okay on the site

Cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old 07-11-2006, 12:37 AM
Special Status
 
Join Date: Mar 2006
Location: Australia
Posts: 1,348
Default Re: php help

You have 2 forms on the index page.. Tell a friend and inquiry. Both forms should be on your BV page (index) which you uploaded onto the server.

The index page contains these forms and as you say, they appear to be working fine.

The forms are not separate files... they are only compnents added to the page, in your case, the index page. Think of them as fonts or shapes. So they will not standout as files on the server. The php scripts will standout as they are separtae files with unique names. If you want to modify the forms, you need to do that from within your BV file and then re-upload it onto the server.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old 07-11-2006, 12:44 AM
davidundalicia's Avatar
General & Forum Moderator
 
Join Date: Mar 2006
Location: Mallorca, Spain
Posts: 5,283
Default Re: php help

You have 2 forms but no php files have been ftp uploaded
(or action is not set right)

Looking at your website, I would advise you to start creating
different PAGES for the different subjects......
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old 07-11-2006, 12:48 AM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Default Re: php help

Thanks
I will try this in the morning
I appreciate your help guys

Peter
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old 07-11-2006, 11:57 AM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Question Re: php help

I have now got all the scripts in the right place and the enquiry form is working but I get an syntax error for the tell a friend form that there is an unexpected "@" at line 21. I do not know how to resolve this. Below is the php script.

Thanks

<?php
require("class.phpmailer.php");
@$name = addslashes($_POST['name']);
@$friendname = addslashes($_POST['friendname']);
@$email = addslashes($_POST['email']);
@$subject = addslashes($_POST['subject']);
@$message = addslashes($_POST['message']);
@$youremail = addslashes($_POST['youremail']);

$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "localhost"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->From = ???????@kellyholidays.com; // Your emailin your account
$mail->FromName = "kellyholidays";// The From name you want to appear in the email
$mail->AddAddress($email); //the receiver's email'
$mail->WordWrap = 50; // set word wrap
$mail->Subject = "$subject $name\n";
$mail->Body = "Hi $friendname\n"
. "$message\n "
. " \n"
. " Bye $name\n";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
header("Location: returnpage.html"); // returnpage is the same page of the form or another of your choice.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old 07-11-2006, 01:15 PM
Andy128's Avatar
Major General
 
Join Date: Dec 2005
Location: Michigan
Posts: 2,282
Default Re: php help

This;
$mail->From = $info@kellyholidays.com; // Your emailin your account

needs to be;

$mail->From = "info@kellyholidays.com"; // Your emailin your account

The @ was parsed as it was not in quotes as the script expected it to be.

Also- I am not sure but you may need to put true in quotes also;
$mail->SMTPAuth = "true"; // turn on SMTP authentication


Andy
__________________
My diamond in the rough - www.123gpp.com

* Click here for some BV tutorials (Php mailto Form, I-Frames, Picture display and much, much more!)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old 07-11-2006, 04:38 PM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Question Re: php help

I have changed as suggested and now get the parse error as shown below.




Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_VARIABLE or '$' in /home2/kellscom/public_html/tellafriend.php on line 21
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old 07-11-2006, 07:58 PM
Andy128's Avatar
Major General
 
Join Date: Dec 2005
Location: Michigan
Posts: 2,282
Default Re: php help

hadn't noticed before but....

$mail->Subject = "$subject, $name\n";

Usually variables are seperated by a comma as shown above. Try correcting that on your script.

Where did you get this script from?

Andy
__________________
My diamond in the rough - www.123gpp.com

* Click here for some BV tutorials (Php mailto Form, I-Frames, Picture display and much, much more!)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18  
Old 07-11-2006, 09:03 PM
kamoto's Avatar
Staff Sergeant
 
Join Date: Jun 2006
Location: Scotland
Posts: 42
Send a message via Skype™ to kamoto
Question Re: php help

I have inserted a comma but get the same error.

I downloaded it from the forum. I think it was authored or posted by navman
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19  
Old 07-11-2006, 09:57 PM
Andy128's Avatar
Major General
 
Join Date: Dec 2005
Location: Michigan
Posts: 2,282
Default Re: php help

Ok-
Having looked at that download- this;
$mail->From = $info@kellyholidays.com; // Your emailin your account

Should be;
$mail->From = $youremail; // Your emailin your account

where $yourmail refers to the variable $yourmail from your form. Leave it exactly as it is- do not change $yourmail

You will not need to put- true in " " as I had thought earlier and per Naval's script- do not seperate the variables $subject $name with a comma.

Hope that helps

Andy
__________________
My diamond in the rough - www.123gpp.com

* Click here for some BV tutorials (Php mailto Form, I-Frames, Picture display and much, much more!)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #20  
Old 07-11-2006, 10:53 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: php help

Correct, $youremail must remain as is. And please don't change the code, it will not work. Also change the hidden field of the message, you surely do not want the messahe sent to be: "I found this site very interesting. To visit it, click on www.navaldesign.info "
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!