Jump to content

Htmlradio buttons


shirvo

Recommended Posts

Heres an easy emaple of how the array works ok.


<?php

$a[]="Save my name";
$a[]="Save my username";
$a[]="Save my age";
$a[]="Save my address";

$save_array=array("my name","my username","my age","my address");

foreach ($save_array as $result1){ 

foreach($a as $result2){

$result=$result1.$result2;

echo "you have selected $result to be saved <br>";

}

}

?>

Link to comment
https://forums.phpfreaks.com/topic/37559-htmlradio-buttons/#findComment-181843
Share on other sites

that didn't help. this is what i have

 

<html><head>

</head><body>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

<table>

<tr><td>Username:</td><td><input type="text" name="user" maxlength="40" value="<? echo $_COOKIE['username']; ?>"></td></tr>

<tr><td>Password:</td><td><input type="password" name="pass" maxlength="40" value="<? echo $_COOKIE['password']; ?>"></td></tr>

<tr><td colspan="2"><input type="radio" name="V1[1]">Save my username and password</td></tr>

<tr><td colspan="2"><input type="radio" name="V1[2]">Save my username</td></tr>

<tr><td colspan="2"><input type="radio" name="V1[3]">Ask for my username and password</td></tr>

<tr><td colspan="2"><input type="submit" value="Login" name="login"></td></tr>

</table>

</form>

</body></html>

 

so what am i meant to put in the name for each radio button

Link to comment
https://forums.phpfreaks.com/topic/37559-htmlradio-buttons/#findComment-181846
Share on other sites

<html><head> 
</head><body> 
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr><td>Username:</td><td><input type="text" name="user" maxlength="40" value="<? echo $_COOKIE['username']; ?>"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="40" value="<? echo $_COOKIE['password']; ?>"></td></tr>
<tr><td colspan="2"><input type="radio" name="V1[]">Save my username and password</td></tr>
<tr><td colspan="2"><input type="radio" name="V1[]">Save my username</td></tr>
<tr><td colspan="2"><input type="radio" name="V1[]">Ask for my username and password</td></tr>
<tr><td colspan="2"><input type="submit" value="Login" name="login"></td></tr>
</table>
</form>
</body></html>

 

now look at my example agin ok.

Link to comment
https://forums.phpfreaks.com/topic/37559-htmlradio-buttons/#findComment-181848
Share on other sites

<html><head>

</head><body>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

<table>

<tr><td>Username:</td><td><input type="text" name="user" maxlength="40" value="<? echo $_COOKIE['username']; ?>"></td></tr>

<tr><td>Password:</td><td><input type="password" name="pass" maxlength="40" value="<? echo $_COOKIE['password']; ?>"></td></tr>

<tr><td colspan="2"><input type="radio" name="V1[]" value="yes">NAME</td></tr>

<tr><td colspan="2"><input type="radio" name="V1[]" value="yes">PASSWORD</td></tr>

<tr><td colspan="2"><input type="submit" value="Login" name="login"></td></tr>

</table>

</form>

</body></html>

 

This might work if the user selected

name AND PASSWORD then update the database or otherwise dont.

 

<?php

foreach($V1 as $x){

if(($x=="yes"){

//update database

}else{

echo " You must select username and password to register"; 

}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/37559-htmlradio-buttons/#findComment-181860
Share on other sites

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.