/    Sign up×
Community /Pin to ProfileBookmark

handling Radiobuttons

greetings!
I have a .html file which goes like this:

[code]
//step.html
<html><body>
<h2>Get started!</h2>
I want to log in
<input type=”radio” checked=”checked” name=”Type” value=”Login”>
<br>
I want to register with the following
<input type=”radio” name=”Type” value=”Register”>
</form>
<form action=”session.php” method=”post”>
username: <input name=”user” type=”text”/><br>
and password: <input name=”password” type=”password”/>
<input type=”submit” value=”submit”/></form>
</html></body>[/code]

and a php file that handles the user name and password very well. it does what it has to do with them. The problem comes when handling the radiobuttons value, it seems like it does not get anything from it:

[code]//session.php
<html><body>
<?php
$user = $_POST[“usuario”];
$pass = $_POST[“password”];
$login = $user . $pass . “.txt”;
$accion = $_POST[‘Type’];

if (file_exists($login))
{
echo “<html><head><META HTTP-EQUIV=”Refresh” CONTENT=”5;URL=mostrar.php?login=$login”></head><body>User found. logging in”;
echo “<br>$login</body></html>”;

}
else
{
echo “<html><head><META HTTP-EQUIV=”Refresh” CONTENT=”5;URL=step.html”></head>”;
echo “<body>User not found, try again<br>$login<br>$user<br>$pass<br>$accion</body></html>”;
}
?>

</html></body>[/code]

The intended purpose for the radiobuttons is that if the user selects Register then instead of logging in, the session.php attemps to create a new account. On the other hand is the user selected Login then session.php will attemp to open up the user’s account.
I set the $accion variable to get the radiobutton value from the $_POST but when the page displays the variables it is empty. I tried using different apostrophes on it but the result is the same. What am I doing wrong??
Thanks! ?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@tegraphixOct 10.2005 — At a first glance, I would change name and values for the radio buttons to all lowercase letters. And maybe add an "id" along with the name.

AND

put beginning form tag above radio buttons!!!!!!!

[CODE]
<h2>Get started!</h2>
<form action="session.php" method="post">
I want to log in
<input type="radio" checked="checked" name="Type" value="Login">
<br>
I want to register with the following
<input type="radio" name="Type" value="Register">
username: <input name="user" type="text"/><br>
and password: <input name="password" type="password"/>
<input type="submit" value="submit"/></form>
[/CODE]
Copy linkTweet thisAlerts:
@purefanauthorOct 10.2005 — ROFL!!!!! I CANT BELIEVE IT!!!

i am so embarrased...please forgive my stupidity...
×

Success!

Help @purefan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...