HELP! Newbie needs php advice
Posted: Thu Aug 13, 2009 9:45 pm
I know basicaly zero about PHP and I'm hoping you can help me out. I generated this code with a "php code generator" and it does send info to the mySql DB. But, here's what I'd like to have happen:
1. I'd like to be able to input the form data from a form I built in flash. Right now, it takes the variables from a HTML form.
2. After the form is submitted, it goes to a "next page" how do I keep if from doing that? Just keep it on the same page. It also has an "error" displayed on the new page. Somthing about dead.letter
3. The send email to visitor doesn't work...maybe that has more to do with my webhost?
Here's the code:
<?php
include("header.html");
// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$Company = addslashes($_POST['Company']);
@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
//Sending auto respond Email to visitor
$pfw_header = "From: user@mydomain.com\n"
. "Reply-To: user@mydomain.com\n";
$pfw_subject = "Here's the info you were looking for";
$pfw_email_to = "$Name";
$pfw_message = "Dear $Name\n"
. "\n"
. "Thank you for your interest in our...:\n"
. "\n"
. "Here's more info..\n"
. "\n"
. "And still more info";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//saving record to MySQL database
@$pfw_strQuery = "INSERT INTO `demo`(`Company`,`Name`,`Email`)VALUES (\"$Company\",\"$Name\",\"$Email\")" ;
@$pfw_host = "localhost";
@$pfw_user = "DBname";
@$pfw_pw = "Password";
@$pfw_db = "DBname";
$pfw_link = mysql_connect($pfw_host, $pfw_user, $pfw_pw);
$pfw_db_selected = mysql_select_db($pfw_db, $pfw_link);
//insert new record
$pfw_result = mysql_query($pfw_strQuery);
mysql_close($pfw_link);
?>
Thank you for your help!
1. I'd like to be able to input the form data from a form I built in flash. Right now, it takes the variables from a HTML form.
2. After the form is submitted, it goes to a "next page" how do I keep if from doing that? Just keep it on the same page. It also has an "error" displayed on the new page. Somthing about dead.letter
3. The send email to visitor doesn't work...maybe that has more to do with my webhost?
Here's the code:
<?php
include("header.html");
// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$Company = addslashes($_POST['Company']);
@$Name = addslashes($_POST['Name']);
@$Email = addslashes($_POST['Email']);
//Sending auto respond Email to visitor
$pfw_header = "From: user@mydomain.com\n"
. "Reply-To: user@mydomain.com\n";
$pfw_subject = "Here's the info you were looking for";
$pfw_email_to = "$Name";
$pfw_message = "Dear $Name\n"
. "\n"
. "Thank you for your interest in our...:\n"
. "\n"
. "Here's more info..\n"
. "\n"
. "And still more info";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//saving record to MySQL database
@$pfw_strQuery = "INSERT INTO `demo`(`Company`,`Name`,`Email`)VALUES (\"$Company\",\"$Name\",\"$Email\")" ;
@$pfw_host = "localhost";
@$pfw_user = "DBname";
@$pfw_pw = "Password";
@$pfw_db = "DBname";
$pfw_link = mysql_connect($pfw_host, $pfw_user, $pfw_pw);
$pfw_db_selected = mysql_select_db($pfw_db, $pfw_link);
//insert new record
$pfw_result = mysql_query($pfw_strQuery);
mysql_close($pfw_link);
?>
Thank you for your help!