Jump to content

GETTING A VALUE INTO A HTML FORM


joebudden

Recommended Posts

I have made a list of hyperlinks referring to files in a database. As well as displaying links to the files I also want to give the user the option to delete a file so i added a delete hyperlink to each row.


foreach ($resultArray as $row)
{
$href = $_SERVER['PHP_SELF'] .

"?frmFile=" .

$row['dbArtefactId'];

echo(" <em>(" . $row['dbArtefactId'] . ")</em> ");

echo("<a href='" . $href . "' >");

echo(" <em>(" . $row['dbArtefactFileName'] . ")</em></a>");

echo(" <em>(" . $row['dbArtefactFileType'] . ")</em>");

echo(" <em>(" . $row['dbArtefactFileSize'] . ")</em>");

echo(" <em><a href='deleteFile.php'>Delete</a></em><br />");


}


When the user clicks delete i want the file ID to be displayed within a txt field on a form....................

The code below displays a form which collects the employee thats logged in's ID number..


<?php
echo("<input type='text' name='frmEmployeeId' maxlength='4' ");
if (isset($_SESSION['sessEmployee'] ['id']))
{
echo("value='" . $_SESSION['sessEmployee'] ['id'] . "'");
}
echo(" />");
echo($invalidOwnerNameMessage);
?>

   

Would it be a similar piece of code to display the dbArtefactFileId within a text field on another form


If anyone has ANY help or advice that wud be greatly appreciated!!!!1

TAR
Link to comment
https://forums.phpfreaks.com/topic/29933-getting-a-value-into-a-html-form/
Share on other sites

Yes. As long as you are passing a value to a page it is very simple to populate a field with the value. Just something like this:
[code]<?php
$dbArtefactFileId = ($_POST['dbArtefactFileId'])?$_POST['dbArtefactFileId']?:"";
echo "<input type=\"text\" name=\"'dbArtefactFileId\" value=\"$dbArtefactFileId\">";
?>[/code]

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.