Pls help to resolve php contact form issue - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Pls help to resolve php contact form issue

designstudentdesignstudent Posts: 3Member
Hello friends,

I'm new to php programming. I know less than nothing. I designed html page in which i want contact form which will be used to send the information to the given email ID.

I done the php script part by the help of material and online tutorials. but when i upload the files to the server, I'm getting error like this,

Access denied for user 'root'@'Localhost' to database 'form'

when i asked this to my hosting provider, they asked me to provide my database connecting settings in my mysql connection string that i'm using in my code. But quite frankly i don't know what that does mean.

I'm really in a tight position to upload the file to the server.

Here are my codes. Can anyone really help me to how to fix this issue?

config.php

[code]<?php
$host = 'Localhost';
$user = 'root';
$pass = '';
$dbname = 'form';

$conn = mysql_connect($host,$user,$pass) or die(mysql_error());
$selectdb = mysql_select_db($dbname,$conn) or die(mysql_error());
?>[/code]


function1.php

[code]<?php
require_once 'config.php';
session_start();


if(isset($_REQUEST['process']))

{

$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$mobile=$_REQUEST['mobile'];
$mess=$_REQUEST['message'];


$to="[email protected]";
$to="[email protected]";
$subject = "Contact Us";
$message="<html>
Name: ".$name."
Email: ".$email."
Mobile : ".$mobile."
Message : ".$mess."
";

$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "
";
$headers .= "From: ".'calltuktuk.com'."
";
$headers .= "Reply-To: ".'calltuktuk.com'."
";

@mail($to, $subject, $message, $headers);

header('Location: index.php?true');exit;
}

/*Contact form*/
function myform($vars)
{
$name= $vars['name'];
$email=$vars['email'];
$mobile = $vars['mobile'];
$message = $vars['message'];

$selqry = "SELECT * FROM contact_form";
$rsqry = mysql_query($selqry)or die(mysql_error()) ;
$cnt = mysql_num_rows($rsqry);

$insert = "INSERT INTO contact_form(name,email,mobile,message) VALUES('$name','$email','$mobile','$message')";
$rscourse=mysql_query($insert) or die (mysql_error());
$lastid = mysql_insert_id();

header('Location:index.php?true');exit;
}
?>
[/code]

Thanks in advance.
Regards,
Sam

Comments

  • debtreliefdebtrelief Posts: 2Member
    YOU CAN INSERT THIS TO HTML PAGE AND YOU CAN SAVE AS .htm

























    Name : *
    Email Address : *
    Message : *
       
     



    BUT IN THIS AREA
    YOU CAN INSERT THIS TO YOUR PHP PAGE AND YOU CAN SAVE AS form.php

    <?PHP
    $to = "YOUR [email protected]";
    $title .= "Inquiry from YOURSITE

    ";

    $msg .= "Name: $name
    ";
    $msg .= "Email: $email
    ";

    $msg .= "Message: $message
    ";
    mail($to, $title, $msg, "From:YOURSITE.net
    Reply-To: $email
    ");
    ?>


    [link=http://www.debtrelief-help.org]Debt Relief [/link]
Sign In or Register to comment.