Skip to content

Instantly share code, notes, and snippets.

@wmantly
Created June 3, 2014 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmantly/791ff30b27bfde9dc581 to your computer and use it in GitHub Desktop.
Save wmantly/791ff30b27bfde9dc581 to your computer and use it in GitHub Desktop.
//ip.json
{
"192.168.2.1" : {
"pass" : true
},
"0.0.0.0" : {
"pass" : true
},
"300.2.3333" : {
"pass" : false
},
"300.2.333.3" : {
"pass" : false
}
}
//makeJSON.php
<html>
<head>
<title>JSON Test Maker</title>
</head>
<body>
<?php
$json_data = file_get_contents('ip.json');
$array = json_decode($json_data, true);
echo "<form method='post'>";
foreach ($array as $key => $value) {
?>
<label>Value</label><br />
<input type="text" value="<?=$key?>" /><br />
<label>Valid</label>
<input type="checkbox" name="valid" value="true" <?=$value['pass'] ? 'checked' : ''?> /><br />
<label>Comments</label><br />
<textarea><?=$value['comment']?></textarea><br />
<hr />
<?php
}
?>
<input type="submit" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment