quick question
Posted: Fri Dec 17, 2010 5:08 am
i have got this code:
but i not sure what i need to do with it (i did not write it)
i don't know if it goes with my form or the insert script here they are.
this is the form
and this is the insert script
Code: Select all
// *** Read the value of "Download" (POST or GET method).
if (isset(($_POST['Download'])) $fileName = $_POST['Download'];
if (isset(($_GET['Download'])) $fileName = $_POST['Download'];
// *** Build the link string.
$downloadLink = "<a href=\"$fileName\">Download</a>";i don't know if it goes with my form or the insert script here they are.
this is the form
Code: Select all
<form action="insert.php" method="post">
Name: <input type="text" name="Name" /><br />
Message: <input type="text" name="Message" /><br />
Download: <input name="Download" type="text" /> <br />
<input type="submit" value="Submit" /></form>Code: Select all
<?php
$con = mysql_connect("host","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("b32_5584692_Docs", $con);
$sql="INSERT INTO Docs(Name, Message, Download)
VALUES
('$_POST[Name]','$_POST[Message]','$_POST[Download]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Record added";
header('Location: upload_test.php');
mysql_close($con)
?>