I've been working on a research-type website involving various html forms that are processed using PHP and the resulting data is written to text files.
One of the pages requires the user to click somewhere on an image, based on which area most applies to them. This image is being used as an input type in an html form. The code used for this form is as follows:
Code: Select all
<form action="/formHandler/saveIOS.php" method="post">
<b><center>Inclusion of Other in Self Scale</center></b>
<input type = "hidden" name = "page" value = "IOS">
Please click where in the diagram best corresponds to how close you feel to your partner.<br>
<input type = "image" src = "/images/IOS.gif" name = "image1">
</form>When using the POST method, the resulting array shown on screen upon submission of the form contains the correct values when I add the following code to the beginning of my form handler file.
Code: Select all
echo '<pre>';
print_r($_POST);
echo '</pre>';I have tried assigning the coordinate values (X and Y) to variables such as below:
Code: Select all
$imageX = $_POST['image1_X'];
$imageY = $_POST['image1_Y'];
$fileIn = fopen($fileName, 'a') or die("Unable to open file!");
$lineText = "X = ".$imageX.", Y = ".$imageY."\n\n";
fwrite($fileIn, $lineText);
fclose($fileIn);I also tried POSTing the values directly into the fwrite function as below:
Code: Select all
$fileIn = fopen($fileName, 'a') or die("Unable to open file!");
fwrite($fileIn, $_POST['image1_X'];
fclose($fileIn);Since the values are clearly being stored in the POST array correctly, my initial assumption was that somehow I wasn't storing the values correctly in the variables. However, the initial html form also passes a variable called "page" which I was able write to the text file.
Please note that I did try all of the above steps using the GET method and got the same resuts.
At this point I have searched multiple newsgroups and FAQs for a similar thread somewhere but to no avail.
Still, I am convinced that it's not possible that I am the first person to have ever had this problem.
As such I am posting this in hopes someone can help.
Thank you for your consideration.