/    Sign up×
Community /Pin to ProfileBookmark

php mysql data submit

i found error when posting data i am new to php. so help

<?php
$db_host = “localhost”;
$db_user = “”;
$db_pwd = “”;
$db_name = “uh”;
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);

mysql_select_db($db_name);

$field1 = $_POST[“name”];e
$field2 = $_
POST[“desc”];

if (isset($db_name)) {

// if the product name contains something, meaning that

// the form was submitted, so process it

$strSQL = “INSERT INTO employee (name, desc) Values (’” . $field1 . “’,'” . $field1″’)” ;

$strResult = mysql_query($strSQL) or die(mysql_errno() . ” : ” . mysql_error() . ” <strong>Insert Failed for Some Reason</strong>”);

}

?>

////////////////////////////

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html xmlns=”http://www.w3.org/1999/xhtml“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
</head>

<body>
<form id=”form1″ name=”form1″ method=”post” action=”tst.php”>
<label>
<input type=”text” name=”name” id=”name” />
</label>
<p>
<label>
<input type=”text” name=”desc” id=”desc” />
</label>
</p>
<p>
<label>
<input type=”submit” name=”save” id=”save” value=”Submit” />
</label>
</p>
</form>
</body>
</html>

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@muhammad_shahidauthorMay 08.2008 — this is error,

Access denied for user 'root'@'localhost' (using password: YES)
Copy linkTweet thisAlerts:
@apulmca2k4May 10.2008 — hi,

I am a PHP professionel and I can make u a good PHP developer if u mail me on my mail-id.

Waiting for ur reply.

thanks
×

Success!

Help @muhammad_shahid spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...