PHP

Status
Not open for further replies.

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Hey so I'm making my own vault for an interactive website.

I am not yet coding it to a database as Its just going to be a dummy for now...
I want it so that when a user clicks 'Crack the vault' the php echo's 'Sorry you lost!'

I'm not amazing at php but I had a shot..
Code:
<?php
echo'Sorry you lost'
?>

This just obviously echos the text for anyone too see even if they haven't tried the vault too which I don't want...
I want it to just show for people who clicked crack the vault...

Any help please!?!
 

Khalil

IDK
Dec 6, 2011
1,642
786
I presume "crack the vault" is a submit button within a form?
If it is, then you can do that in this way:

PHP:
<?php if(isset($_POST["submit_button_name_here"])) { print("You lost!"); } ?>
 

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Yep it is, Thanks!

Yep it is, Thanks!
<center>
<div class="settings-buttons">
<input type="submit" style="width: 80%" value="Crack the Vault" name="crackvault" class="submit" style="float:right">
</div>
</center></br>
</form>
<?php if(isset($_POST["Crack the Vault"])) { print("You lost!"); } ?>
<hr /></br>
</div>
</div>
</div>
</div>
Sorry about double post:

Thats where I put it? And it doesn't seem to post you lost!
 
Last edited by a moderator:

Khalil

IDK
Dec 6, 2011
1,642
786
You just ended the form without even starting it.


PHP:
<?php if(isset($_POST["crackvault"])) { print("<script>alert(\"You lost!\")</script>"); } ?>
<form method="POST">
<input type="submit" style="width: 80%" value="Crack the Vault" name="crackvault" class="submit" style="float:right">
</div>
</center></br>
</form>
 

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Thanks but this pops up on the screen as an alert, Is it possible for it to be in text in the box

Like i have a Result: then the php next to it saying you lost?
 

Khalil

IDK
Dec 6, 2011
1,642
786
PHP:
<?php if(isset($_POST["crackvault"])) { print("You lost!"); } ?>

<form method="POST">
<input type="submit" style="width: 80%" value="Crack the Vault" name="crackvault" class="submit" style="float:right">
</div>
</center></br>
</form>
 

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Okay one second. Ill try it in my hotel...
EDIT:
Code:
<div id="column2" class="column">
                        <div class="habblet-container ">
                            <div class="cbb clearfix blue ">
                                <h2 class="title">Crack Wrex's Vault!?!</h2>
                                <div style="padding:5px">
                                <center><img src="/app/tpl/skins/habbo/images/vaultlock.png" align="right">
                                Can you crack our vault!?!  Prizes are automatically added to your account if you win!
                                So if you win, refresh the client!
                                </br> </br><hr />
                                </br>
                                <form method="post" id="vault">
                                <table width="80%" align="center">
                                <tr>
                                <td width="20%"><select name="vault1"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                <td width="20%"><select name="vault2"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                <td width="20%"><select name="vault3"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                <td width="20%"><select name="vault4"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                </tr>
                                </table>
                                <center>
                                <div class="settings-buttons">
           


<input type="submit" style="width: 80%" value="Crack the Vault" name="crackvault" class="submit" style="float:right">
</div>
</center></br>

                       
                       
                                <hr /></br><form method="POST">
                                    Result: <font color="red"><b><?php if(isset($_POST["crackvault"])) { print("You lost!"); } ?></b></font>
                                </div>        </form>
                            </div>
                            </div>
                            </div>
        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
        <script type="text/javascript">
            HabboView.run();
        </script>
I don't see problems in this :S
 

Khalil

IDK
Dec 6, 2011
1,642
786
Tested that, works fine.
Btw, you don't need to put the php code inside a form, and you forgot to end your first form.

Code:
<div id="column2" class="column">
                        <div class="habblet-container ">
                            <div class="cbb clearfix blue ">
                                <h2 class="title">Crack Wrex's Vault!?!</h2>
                                <div style="padding:5px">
                                <center><img src="/app/tpl/skins/habbo/images/vaultlock.png" align="right">
                                Can you crack our vault!?!  Prizes are automatically added to your account if you win!
                                So if you win, refresh the client!
                                </br> </br><hr />
                                </br>
                                <form method="post" id="vault">
                                <table width="80%" align="center">
                                <tr>
                                <td width="20%"><select name="vault1"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                <td width="20%"><select name="vault2"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                <td width="20%"><select name="vault3"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                <td width="20%"><select name="vault4"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option></select></td>
                                </tr>
                                </table>
                                <center>
                                <div class="settings-buttons"><input type="submit" style="width: 80%" value="Crack the Vault" name="crackvault" class="submit" style="float:right"></form></div>
</center></br><hr /></br>Result: <font color="red"><b><?php if(isset($_POST["crackvault"])) { print("You lost!"); } ?></b></font>
</div></div></div></div>
<script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
<script type="text/javascript">HabboView.run();</script>
 

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Working but once its said "Sorry you lost" is it possible to be able to reset the button 5 seconds after it says youve lost or something because, When i reload the page it still says Youve lost :S
 

Khalil

IDK
Dec 6, 2011
1,642
786
Don't reload, if you reload it'll just keep printing the same result.

And you can use html to make the page refresh after 5secs:

PHP:
<?php if(isset($_POST["crackvault"])) { print("You lost! <meta http-equiv=\"refresh\" content=\"5; url=YOURHOTELLINK/PAGENAME\">"); } ?>
 

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Don't reload, if you reload it'll just keep printing the same result.

And you can use html to make the page refresh after 5secs:

PHP:
<?php if(isset($_POST["crackvault"])) { print("You lost! <meta http-equiv=\"refresh\" content=\"5; url=YOURHOTELLINK/PAGENAME\">"); } ?>
Good man i respect you helping me :D
 
Status
Not open for further replies.

Users who are viewing this thread

Top