Wholesaler Posted September 29, 2009 Share Posted September 29, 2009 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 https://forums.phpfreaks.com/topic/175921-solved-pass-value-through-to-a-php-script/ Share on other sites More sharing options...
Wholesaler Posted September 29, 2009 Author Share Posted September 29, 2009 Ok, it doesn't look like it worked and the changes I made wont delete the temp file either. Link to comment https://forums.phpfreaks.com/topic/175921-solved-pass-value-through-to-a-php-script/#findComment-926980 Share on other sites More sharing options...
cags Posted September 29, 2009 Share Posted September 29, 2009 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 https://forums.phpfreaks.com/topic/175921-solved-pass-value-through-to-a-php-script/#findComment-926987 Share on other sites More sharing options...
Wholesaler Posted September 29, 2009 Author Share Posted September 29, 2009 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 https://forums.phpfreaks.com/topic/175921-solved-pass-value-through-to-a-php-script/#findComment-926993 Share on other sites More sharing options...
cags Posted September 29, 2009 Share Posted September 29, 2009 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 https://forums.phpfreaks.com/topic/175921-solved-pass-value-through-to-a-php-script/#findComment-927000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.