...

View Full Version : How to show download link after text input



farnhamit
07-24-2012, 02:07 PM
I want a user to have to enter a pin into a text input box (i.e 1234) and when they click submit a download appears.

Is this possible? I will set the code within my code if possible.

Cheers.

Arcticwarrio
07-24-2012, 02:20 PM
will the pin change or stay the same?
if it stays the same its easy enough

Arcticwarrio
07-24-2012, 02:24 PM
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?PHP
if (isset($_POST['pin'])){
if ($_POST['pin'] == '1234'){
echo '<a href="yourlink.ext">Click here to download</a>';
}else{
echo 'Incorect Pin - Please try agian
<form id="form1" name="form1" method="post" action="">
<label for="pin">Enter Pin: </label>
<input type="text" name="pin" id="pin" />
<input type="submit" name="submit" id="submit" value="GO" />
</form>';
}
}else{
echo '<form id="form1" name="form1" method="post" action="">
<label for="pin">Enter Pin: </label>
<input type="text" name="pin" id="pin" />
<input type="submit" name="submit" id="submit" value="GO" />
</form>';
}
?>

</body>
</html>

farnhamit
07-24-2012, 03:32 PM
This is great! works a treat,

Only issue is i have my content placed in switch able divs, and when you enter password it closes the div, Is there any chance of auto opening the lnk if pin is correct?

Thank you.



<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?PHP
if (isset($_POST['pin'])){
if ($_POST['pin'] == '1234'){
echo '<a href="yourlink.ext">Click here to download</a>';
}else{
echo 'Incorect Pin - Please try agian
<form id="form1" name="form1" method="post" action="">
<label for="pin">Enter Pin: </label>
<input type="text" name="pin" id="pin" />
<input type="submit" name="submit" id="submit" value="GO" />
</form>';
}
}else{
echo '<form id="form1" name="form1" method="post" action="">
<label for="pin">Enter Pin: </label>
<input type="text" name="pin" id="pin" />
<input type="submit" name="submit" id="submit" value="GO" />
</form>';
}
?>

</body>
</html>

farnhamit
07-24-2012, 03:34 PM
DONT WORRY,

I have worked it out using iframe ;)


This is great! works a treat,

Only issue is i have my content placed in switch able divs, and when you enter password it closes the div, Is there any chance of auto opening the lnk if pin is correct?

Thank you.

Arcticwarrio
07-24-2012, 03:52 PM
yes you could use



<?PHP
if (isset($_POST['pin'])){
if ($_POST['pin'] == '1234'){
header('Location: /yourfile.ext');
}else{



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum