The official web hosting company for the BlueVoda Website Builder. You are currently viewing our support forum as a guest which gives you limited (read only) access. By joining our support forum you will be able to ask questions, participate in discussions and receive assistance. Registration is fast and simple. Click Here To Join our support forum today! We look forward to helping you build and publish a fantastic website.
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?
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.
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)
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.
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.
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.
$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.
Comment