FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Contact form





sparty
HI
I am not related with PHP so I need help with PHP file that is linked with my flash form.
Now form is sending me mail with information that users have posted. I want that and to save that information on the server too.
Here is code so if someone can please help me.

<?php


#$name = $_POST['name'];
#$email = $_POST['email'];
#$message = $_POST['message'];
#$emailaddress = $_POST['xxxxx@gmail.com'];
$emailaddress = "xxxxxi@gmail.com";
$emailmessage = "Name: $_POST[name] \n\n E-Mail Address: $_POST[email] \n\n Message: $_POST[message] \n\nIP: $_POST[IPADRESS]";


$_post['ipadress];



if(mail($emailaddress, 'Message', $emailmessage)){
echo "Mail je uspjesno poslan. Smile";
} else {
echo "Mail nije uspjesno poslan. ;(";
}

?>
Simulator
Code:
$insert = "INSERT INTO `table_name` ( `$name`, `$email`, `$message`, `$emailaddress`)
VALUES('$name', '$email', '$message', '$emailaddress' )";

mysql_query($insert);


I take it you have a connection and a database setup?
sparty
Simulator wrote:
Code:
$insert = "INSERT INTO `table_name` ( `$name`, `$email`, `$message`, `$emailaddress`)
VALUES('$name', '$email', '$message', '$emailaddress' )";

mysql_query($insert);


I take it you have a connection and a database setup?





I am not sure. How can I know?
And if I don't what I should do
NG
did u hav a dbconnect.php or config.php ?
sparty
I am totally beginner, have no clue about PHP.
I have created site with flash, because my job is creating animations, and I am familiar with flash, but as I said in web design I am totally beginner.
PHP file that I use is copied from some tutorial that I have founded on pixel2life.com
So I do not know what is dbconnect.php or config.php
I have created site, putted in public_html and also put there php file, one that I have written at the start of this page.
Now “I” want to create script that will also save information that is sending thru the mail on the server in MS access or csv or even txt file. So if some one can tell me what should I do or if can give me some guides or even link to some tutorial I’ll be grateful
hexkid
sparty wrote:
Now form is sending me mail with information that users have posted. I want that and to save that information on the server too.
Here is code so if someone can please help me.


If you don't want to use a database, just save the data to a file ...
Code:
<?php

// ... your code

if (mail($emailaddress, 'Message', $emailmessage)) {
  echo "Mail je uspjesno poslan. :)";

  ### move these lines out of the if() if you want to save always
  $file_handle = fopen(date('YmdHis') . '.txt', 'ab');
  if (!$file_handle) {
    exit('Unable to open file.');
  }
  if (fwrite($filehandle, $emailmessage) === false) {
    exit('Problem appeared when writing to the file.');
  }
  if (!fclose($filehandle)) {
    exit('Problem appeared when closing the file.');
  }

} else {
  echo "Mail nije uspjesno poslan. ;(";
}
?>
sparty
Thanks...
NG
Code:
<?php

INCLUDE UR CODE HERE!

if (mail($emailaddress, 'Message', $emailmessage)) {
  echo "Mail. :)";

  $file_handle = fopen(date('YmdHis') . '.txt', 'ab');
  if (!$file_handle) {
    exit('Unable to open file.');
  }
  if (fwrite($filehandle, $emailmessage) === false) {
    exit('Problem appeared when writing to the file.');
  }
  if (!fclose($filehandle)) {
    exit('Problem appeared when closing the file.');
  }

} else {
  echo "Mail nije uspjesno poslan. ;(";
}
?>


try tht its abit better
Related topics
contact form
Need a simple Contact form
For those who need a contact form
I am trying to build a contact form using php and flash
contact form with IP feature ?
AJAX and PHP contact form
Contact Form prob
Need a Contact form from HTML/PHP
Need help to make my Flash contact form functioning!
Easy Contact Form with Instructions
Create a Flash Contact form, sends to your email account
Spam protection for contact form?
Contact form or email address?
Wordpress Contact Form 7 not appearing on Custom Theme
Contact Form Issues
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.