HELP! Newbie needs php advice

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
skubeedoo
Forum Newbie
Posts: 7
Joined: Wed Jun 17, 2009 12:05 pm

HELP! Newbie needs php advice

Post by skubeedoo »

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!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: HELP! Newbie needs php advice

Post by requinix »

How about you try learning the language?
skubeedoo
Forum Newbie
Posts: 7
Joined: Wed Jun 17, 2009 12:05 pm

Re: HELP! Newbie needs php advice

Post by skubeedoo »

Well, after several days of combing the web and pouring through PHP manuals (and lots of brain damage) I had an idea that the bright (and helpful) minds here might be able to give me some help. I posted it since it's short and someone with strong PHP skills could probably see the answer in an instant and keep me from more brain damage. But, thanks for your suggestion.
littleg
Forum Newbie
Posts: 5
Joined: Fri Aug 14, 2009 9:24 am

Re: HELP! Newbie needs php advice

Post by littleg »

"Well, after several days of combing the web and pouring through PHP manuals"

lol.

When you figure this out you should definatly keep on trying to learn this language. When you can program and code you realise how easy you can make every day tasks.
webmonkey88
Forum Newbie
Posts: 20
Joined: Fri Aug 14, 2009 4:30 am

Re: HELP! Newbie needs php advice

Post by webmonkey88 »

I have never used a flash form so have no idea about posting a form in flash and have actually never seen one I would stick with html forms. if you wish the form to post to the current page in the action="" put the name of the page you wish it to send to. Sending an email can be done with the mail() function.

But I would definitely recommend learning the language, to program you should know HTML really then start with PHP and MYSQL.

A very good website I have used is w3schools great tutorials on there.
Post Reply