Jump to content

Quick question about forms


dsjoes

Recommended Posts

i have got this code:

// *** 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>";

 

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

<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>

 

and this is the insert script

<?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)
?>

Link to comment
https://forums.phpfreaks.com/topic/221989-quick-question-about-forms/
Share on other sites

i am trying to make my form easier to use.

 

i have a upload form on the admin part of my site so i can upload word docs and after i have done that i use this form to give the information in a table and a link to open/download the doc. but at the minute i have to type this in the download part of the form everytime.

 

 This
<a href="test.doc">Download</a>
in here
Download: <input name="Download" type="text" />

 

so i am wanting to be able to just type the name of the doc in and the form makes it the link for me.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.