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>

Link to comment
Share on other sites

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']; ?>">

Link to comment
Share on other sites

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)

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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