Hello everyone and this is my first post as I am completely new to PHP but trying hard to pick it up. The problem I have is this:
I am completely new to PHP and trying very hard to teach myself how to use it as I am stepping up to database websites.
I have created an MySQL database on GoDaddy and a duplicate on my laptop with phpmyadmin. Both are ok. I set up a testing server in Dreamweaver for the one on my laptop to try out an input info form and it worked perfectly. I have a connection to the database on localhost and the data from the form inserted into the datbase perfectly.
Now I need to adapt that same form to do exactly the same but input info in my database on GoDaddy.
I have looked on their help section and used the example that they give. But to no joy, I cannot connect to the datbase despite using the correct login details so I am assuming it must be somehting I am doing wrong with the PHP coding. Can someone please take a look at this and tell me where I am going wrong.
Many thanks in anticipation. I have changed the actual details with capitals to show you.
<?php
//Connect To Database
$hostname="HOSTNAME PROVIDED BY GoDADDY.hostedresource.com";
$username="MY USERNAME";
$password="MY PASSWORD";
$dbname="vixtay.db";
$usertable="members";
mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);
$sql="INSERT INTO registrants (Name, Telephone, Email, Username, Password)
VALUES
('$POST[name]','$POST[telephone]','$POST[email]','$POST[username]','$_POST[password]')))";
if($result)
{
while($row = mysql_fetch_array($result))
{
$name = $row["$yourfield"];
echo "Name: ".$name."<br>";
}
}
?>
<html>
<body>
<form action="http://www.southwalespropertysolutions.com/insertinfo.php" method="post">
<table width="300" border="1">
<tr>
<td>Name:</td>
<td><input name="name" type="text" id="name" size="40" /></td>
</tr>
<tr>
<td>Telephone:</td>
<td><input name="telephone" type="text" id="telephone" size="40" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" id="email" size="40" /></td>
</tr>
<tr>
<td>Username:</td>
<td><label>
<input name="username" type="text" id="username" size="40">
</label></td>
</tr>
<tr>
<td>Password:</td>
<td><label>
<input name="password" type="text" id="password" size="40">
</label></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" /></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
</body>
</html>
My other problem is that I want to set up a testing server in Dreamweaver for ny GoDaddy DB to test it out before uploading but cannot find any settings for it and doesn't work with the info that I put in this form for host etc.