Jump to content

[SOLVED] Pass value through to a php script


Wholesaler

Recommended Posts

Hi,

 

The guy who usually does the php isnt online and I need to release a project asap my problem is that I don't know php and I am doing some reading - anyway I need to pass the value passed through download to the php script that I am calling but I have no idea how to do this.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Login</title>
  </head>
  
   <body>
     <form method="POST" action="check1.php?download=<?php $_GET['download'] ?>">
       Username:<br />
      <input type="text" name="username" />
      <br /><br />
      Password:<br />
      <input type="password" name="password" />
      <br /><br />
       <input type="submit" id="subbut" value="Submit" />
    </form>
  </body>
</html>

Assuming I understand you, the code you have looks essentially correct bar one thing. You have <?php $_GET['download'] ?> which assumably means you want the value of $_GET['download'] to appear at that point in the HTML, that being the case you need to echo/ print it out. (also don't forget the semicolon)

 

<form method="POST" action="check1.php?download=<?php echo $_GET['download']; ?>">

Thanks so much, one more question I have tried unlink($fileName); to delete a file but I am unable to get it to work.

 

Is this what I should be using to delete the file?

 

$fileName = uniqueFilename($username);
$fh = fopen($fileName, 'w') or die("can't open file");
fputs($fh, put data in file);
fclose($fh);

output_file($fileName, 'test.txt', ''); 
                    
unlink($fileName)

 

unlink certainly should be the correct way to delete a file. The fact that you use fclose, should mean that the file won't be locked. To my knowledge output_file is not a built in PHP function, so I rather suspect whatever that function does is causing what you are percieving as the problem.

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.