I am not using images. I am going to upload files and I want a permanent link to a delete or edit page. I am new to MySql, but not PHP, and I have no idea what I'm doing. Can you make this a little easier to understand and simpler? I want to create a page called $id_admin.php or something and make it a permanent page so the uploader can delete or edit the file when they want to.
DO I NEED THIS CODE??
I have this code so far for edit.php:
Code: Select all
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
}
$result = mysql_query("Select id, Name, Location From pub_f Where id='$id' ");
while(list($id, $Name, $Location) = mysql_fetch_array($result))
{
echo '<form action="edit.php" action="post">
<input type="text" name="Name" value="' . $Name .'" size="25"><br />
<input type="text" name="Location" value="' . $Location . '" size="25"><br />
<input type="submit" name="edit" value="Edit"><br />
<input type="submit" name="delete" value="Delete">';
}
// Then on submit check for whether or not you want to edit or delete
if(isset($_POST['edit']))
{
//create edit db scrtip ect...
}
elseif(isset($_POST['delete']))
{
//create delete db script
}
else
{
echo "your error message";
}
?>
and this for page.php:
Code: Select all
<?php
mysql_connect("mysql7.000webhost.com", "username", "password") or die(mysql_error());
echo " ";
mysql_select_db("uFiles") or die(mysql_error());
echo " ";
$result = mysql_query("Select id, Name, Location From pub_f");
while(list($id, $Name, $Location) = mysql_fetch_array($result))
{
echo "<tr><td>" . $id . "</td><td>" . $Name . "</td><td>" . $Location . "</td><td><a href='edit.php?id=" . $id . "' >Edit or Delete</a></tr>";
}
?>
I have this code for upload.php:
Code: Select all
<?php
$target = "public/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file has been uploaded <a href='http://www.filefetchers.co.cc/$target'>here</a>.";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
and this for uploader.php:
Code: Select all
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
I want to upload a file and see a link on my screen saying that:
Your file has been uploaded to: "
http://www.someplace.com/public/filename.ext". Edit or Delete your file here: "
http://www.someplace.com/public/filename_admin.php