Jump to content

NEWBI PLEASE HELP ME WITH THIS MYSQL / FORMS / ADDING TO DATABASE


mrcoda

Recommended Posts

please look at this for me. its throwing up this error    , not even the echo works. VERY NEWBEE.

 

Parse error: syntax error, unexpected '[' in /home/rbcreati/public_html/update_quickcontacts.php on line 3

 

heres the php file.

 

<?php

echo "hello";

$name=$_POST=["name"];

$company=$_POST=["company"];

$email=$_POST["email"];

mysql_connect ("localhost", "rbcreati_richard",  "burb1971") or die ('Error: '  . mysql_error());

mysql_select_db ("rbcreati_clients");

?>

 

and here the xhtml

 

<?xml version="1.0" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="description" content="RB CREATIONS. WEB DESIGN, GRAPHIC DESIGN , DIGITAL PHOTO EDITING, SEO. Search engine optimisation explained in simple terms for business people, web design explained in simple terms for business people. Websites Built to W3C Standards XHTML STRICT, Fast loading graphics, Bespoke designs. " />

 

<meta name="keywords" content="web design, design web, graphic design, digital photo, creative design, flash, photo editing, flash, seo, xhtml  "  />

<link href="allstyles.css" rel="stylesheet" type="text/css" />

<title>WWW.RBCREATIONS.CO.UK---------web design----graphic design----digital photo optimising and editing-----search engine optimisation SEO----</title>

</head>

 

<body>

 

<div>

<form action="update_quickcontacts.php" method="post" id="quickcontact" >

<fieldset>

contact name<br /><input name="name" type="text" size="25" maxlength="30" /><br /><br />

company<br /><input name="company" type="text" size="25" maxlength="50" /><br /><br />

email<br /><input name="email" type="text" size="25" maxlength="50" /><br /><br />

<input type="submit" value="up date database" />

</fieldset>

</form>

</div>

 

 

</body>

</html>

 

check it "NOT" working at http://www.rbcreations.co.uk/quickcontact.html 

Link to comment
Share on other sites

now there no data carried into the database. i'm getting new rows, thats it

 

<form action="update_quickcontacts.php" method="post" id="quickcontact" >

<fieldset>

contact name<br /><input id="name" type="text" size="25" maxlength="30" /><br /><br />

company<br /><input id="company" type="text" size="25" maxlength="50" /><br /><br />

email<br /><input id="email" type="text" size="25" maxlength="50" /><br /><br />

<input type="submit" value="up date database" />

</fieldset>

</form>

 

<?php

$name=$_POST["name"];

$company=$_POST["company"];

$email=$_POST["email"];

mysql_connect ("localhost", "rbcreati_richard",  "burb1971") or die ('Error: '  . mysql_error());

mysql_select_db ("rbcreati_clients");

$query = "INSERT INTO quickcontacts VALUES ('','$name','$company','$email')";

mysql_query($query);

?>

Link to comment
Share on other sites

thanks mate ,  problem solved, a little thing eaI changed the root folder and was uploading and changing for a while and realised the updated files were going to the wrong place. A real mind boggler , especially when coding and every character can throw you. Be warned newbees and oldschool alike.  Thanks both of you for your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.