Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

PHP button to MYSQL database with dreamweaver 8


  • Please log in to reply

#1
andy_b_1502

andy_b_1502

    Member

  • Member
  • PipPip
  • 40 posts
I apologise in advance for maybe posting in the incorrect area/forum.


Ok, So i have made a form in my website and once the button is clicked, i want the details of the customer to go to my MYSQL database on the host's server at ipage.com. Please bear in mind (if you have not gathered already, that i am very new to MYSQL so im having major problems grasping it).

Here is the web form code:

<form id="handy_form" name="handy_form" method="post" action="sendmail.php">
<p>Name:</p>
<p>
<input type="text" name="textfield" />
</p>
<p>Email: </p>
<p>
<input type="text" name="textfield2" />
</p>
<p>Product Type (vinyl/tinting/clothing): </p>
<p>
<input type="text" name="textfield3" />
</p>
<p>Your Message: </p>
<p>
<textarea name="textarea"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>


The button runs "sendmail.php" script here:

<?PHP

$user_name = "root";
$password = "";
$database = "my_db";
$server = "localhost";

mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($my_db,$db_handle);

if ($db_found) {
$SQL = "INSERT INTO tb_my_db (Name, Email, Product, Message) VALUES ('bill', 'gates', 'Microsoft')";
$result = mysql_query($SQL);
mysql_close($db_handle);

print "Records added to the database";


while ($db_field = mysql_fetch_assoc($result)) {
print $db_field['ID'] . "<BR>";
print $db_field['Name'] . "<BR>";
print $db_field['Email'] . "<BR>";
print $db_field['Product'] . "<BR>";
print $db_field['Message'] . "<BR>";
}
mysql_close($db_handle);
}
else {
print "Database NOT Found";
}

print "Connection to the Server opened";

?>


The sendmail.php code has changed over and over agian, after reading different tutorials and help guides on how to perform this task.

The problem im getting is; when i setup the testing server in Dreamweaver, and then add a new MYSQL connection i enter the details:


Connection name: db_connection
MYSQL server: localhost
Username: Handy
Password: *****
Database:(select)

I click on select, and it tries to connect. I then get the error message:

HTTP error code: 404 file not found. Here are some possible reasons for the problem.

1) There is no testing server running on tis machine.
2) The testing server for this site does not map to the http://www.handygrap...ts/MMHTTPDB.php URL. Verify that URL prefix maps to the root of the site.

So, i go to the testing server and change the URL prefix to http://www.handygrap...ts/MMHTTPDB.php and click ok. I get this error message:

The site URL prefix [/_mmServerScripts/MMHTTPDB.php] for the testing server does not match the site URL prefix [] specified in HTTP address for the site. This may cause pages using site relative links to display inccorectly at run time. Proceed anyway?

I click OK, and then try to add the MYSQL connectoin again and select the database on the server. Only to get the same error message.
I would like to understand whats happening here? am i doing everything right, or making a complete mess of things?

I really hope you guys can help me as i need this web form up and running as soon as possible for my customers.

MANY thanks in advance for any help i get!!!

Andy
  • 0

Advertisements


#2
andy_b_1502

andy_b_1502

    Member

  • Topic Starter
  • Member
  • PipPip
  • 40 posts
bump. :)
  • 0

#3
andy_b_1502

andy_b_1502

    Member

  • Topic Starter
  • Member
  • PipPip
  • 40 posts
I have just read an article from adobe that PHP with windows may cause this error to occur? just wondered if this is true, if so what are my work-arounds to creating this web form with the button that sends info to the database and email address?

Thank you
  • 0

#4
andy_b_1502

andy_b_1502

    Member

  • Topic Starter
  • Member
  • PipPip
  • 40 posts
solved
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP