I'm trying out php for the first time and I can't figure out the solution to what I am trying to do. I have (at least) 3 files: form.php, compute.php, and the seperate array files lines1.php for example. What I need is for five inputs in the form, then the compute file to take those inputs and pull specific line(s) from the array file to be determined by the inputs. So far I have made my form file and all is working with it. In my compute file I have successfully included the target array file, what I am having trouble with is getting it to echo the array I need from it. here are examples of my three files:
Form.php
<script language="JavaScript">
function redirectOutput(myForm)
{
var w = window.open('about:blank','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=600');
myForm.target = 'MyWindow';
return true;
}
</script>
<form action="Compute.php" method="GET" onSubmit="redirectOutput(this)">
<select name="Book">
<option value="Book1">Book1</option>
<option value="Book2">Book2</option>
</select>
<select name="Chapter">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="text" name="LineStart" />
<input type="text" name="LineEnd" />
<input type="submit" value="Go!">
</form>
Compute.php
<?php
$Include=$_GET["Book"] . $_GET["Chapter"] . ".php";
$LineStart=$_GET["LineStart"];
$LineEnd=$_GET["LineEnd"];
$Line=$LineStart;
$BookChapter=$_GET["Book"] . $_GET["Chapter"];
include("$Include");
while($Line<=$LineEnd)
{
echo $BookChapter[$Line] . "<br>";
$Line++;
}
?>
Specified array file, Book11.php for example (Book1 being the book and 1 being the chapter)
<?php
$Book11[0]="Example of line 1.";
$Book11[1]="Example of line 2.";
$Book11[2]="Example of line 3.";
?>
With what I have so far all it outputes is the character from the title of the variable corresponding the the current value of $Lines. Is there something special I have to do to combine these different variables to pull the value of the array? Please Help!