mardi 24 mars 2015

PHP show/hide form in a website maker platform


I am using this site to make a website. This website maker is easy to use because the elements are just drag and drop but you can also add your HTML code.


In one of my pages, I have inserted an HTML code which is a form. The form's process is to ask for a password, then with the GET method, it will check if the password is correct, if correct, another form will show. I use PHP language to process the checking of password. The problem that I encounter is, when the right password is entered, it does not show anything, even if I have put the right id. This is the preview site


HTML Code



<form name="password" id="password" style="width:300px;" method="get" action="http://ift.tt/1EF4YmX">
<label for="password">
Enter password:
</label>
<input type="password" id="1151457790" name="password" required=""/>
<input type="submit" id="submit" name="submit" value="Submit"/>
</form>

<form name="transfer" id="transfer" method="POST" action="http://ift.tt/1EF4YmZ" style="display: none;">
<select id="affAccts" name="affAccts" required="">
Select an account:
<option value="A">
A
</option>
<option value="B">
B
</option>
<option value="C">
C
</option>
</select>
<br/>
<label for="name">
Enter name:
</label>
<input type="text" id="name" name="name" required=""/>
<input type="submit" value="Join"/>
</form>


PHP



<?php

$pw = $_GET['password'];

if($pw == "Admin1234"){?>
<script type="text/javascript">
$('#password').hide();
$('#transfer').show();
</script>
<?php}else{?>
<script type="text/javascript">
alert("Access Denied!");
location.reload();
</script>
<?php
}
?>




Aucun commentaire:

Enregistrer un commentaire