Skip to content

Instantly share code, notes, and snippets.

@Shakil-Shahadat
Created September 4, 2017 01:26
Show Gist options
  • Save Shakil-Shahadat/8858f38d00e8c15dd752c4e680a1dc5d to your computer and use it in GitHub Desktop.
Save Shakil-Shahadat/8858f38d00e8c15dd752c4e680a1dc5d to your computer and use it in GitHub Desktop.
Form Input Test: Variable Value in Radio Input, Proof of Concept
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form Input Test: Variable Value in Radio Input, Proof of Concept (Success)</title>
</head>
<body>
<?php
// echo "<pre>"; print_r( $_POST ); echo "</pre>";
echo 'Submitted Data: myChoice = ';
if ( isset( $_POST[ 'myChoice' ] ) && $_POST[ 'myChoice' ] === 'Bangla' ) echo $_POST[ 'myChoice' ];
else echo $_POST[ 'myOtherChoice' ];
?>
<form method="post">
<label><input type="radio" name="myChoice" value="Bangla" required> Bangla</label>
<input type="radio" name="myChoice" value="Other">
<input type="text" name="myOtherChoice" value="English"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment