Hi all
I am gettting a file and exploding it by '=' to get an array in two parts, 0 and 1. Part 1 is used in a form to show the output.
The problem I have is when I get to a select input, I want the value of 1 for this part of the array.
For some reason, I cant test if it is true or false, I guess this it is not a string?
Code:
$file_handle = fopen("saves/server.properties", "rb");
$vars = array();
while (!feof($file_handle) )
{
$line_of_text = fgets($file_handle);
$parts = explode('=', $line_of_text);
//if date not required
if ( !isset($parts[1]) )
{
continue;
}
$vars[$parts[0]] = $parts[1];
}
?>
<form class="clean" method="post">
<ol>
<li>
<fieldset>
<legend>Server Properties </legend>
<ol>
<li style="">
<label for="nether">Allow Nether</label>
<select id="nether" name="nether">
<option <?php if ( $vars['allow-nether'] = "true" ) echo 'selected="selected"'; ?> value="true" >True</option>
<option <?php if ( $vars['allow-nether'] = "false" ) echo 'selected="selected"'; ?> value="false" >False</option>
</select>
Anyone help out?