Jump to content

Radio button with a bit of PHP.


GeoTop

Recommended Posts

Hi,
I want to make a site similiar to this.
http://hacker.sax777.com/

The way it works is, when there is proper text input in the field, it goes to the next page without the url changing, if its wrong, it displays an error message. I'd be very thankfull if someone would scrap up that small piece of code for me,
Link to comment
https://forums.phpfreaks.com/topic/27707-radio-button-with-a-bit-of-php/
Share on other sites

[code=php:0]

<?
if($_POST['code'] != "answer"){
echo "Wrong password!";
?>
<form method="POST" action="current-page.php">
<input type="text" value="" name="code">
<input type="submit" value="Submit" name="submit">
</form>
<?
}else{
header("Location:http://www.dom.com/nextpage.php");
}
?>
[/code]
[code]
<?php
function Redirect($time, $topage) {
echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$topage}\" /> ";
}

if($_POST['code'] != "answer"){
echo "Wrong password!";
?>
<form method="POST" action="current-page.php">
<input type="text" value="" name="code">
<input type="submit" value="Submit" name="submit">
</form>
<?php
}else{
Redirect(0,"http://www.dom.com/nextpage.php");
}
?>[/code]
I know this doesn't help your cause much, but it seems you are trying to run before you can walk, there are some great tiutorials
[url=http://www.phpfreaks.com/tutorial_cat/8/Basics-&-Beginner-Tutorials.php]here[/url] on picking up php, after reading through some of them check back at the above pasted code and it may make more sense.
It looks like part of your problem has to do with the interaction of PHP & Dreamweaver. I suggest you look at the forum that deals with Dreamweaver and see if there is an answer there. I don't use it, so I can't help you.

Ken

Archived

This topic is now archived and is closed to further replies.

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