excel if condition to php script
I've created an excel spreadsheet to calculate no. Basically if only need
to enter the value into 3 cells only, the cell highlighted in yellow color
is the one need to key in. The others cell value will automatically
increase. You may refer to the picture below for a clearer picture on what
I mean.
Picture: http://i.imgur.com/rPrQIJL.jpg
So from excel I shifted the 3 cells to html input file which user can
input the value, the submit button will trigger the scripts and extract
the result on itself as well.
My HTML:
<form action="calculator.php" method="post" enctype="text/plain">
First Row: <input type="text" name="r1a" />
Second Row: <input type="text" name="r2a" />
Third Row: <input type="text" name="r3a" />
<input type="submit" value="Go" src="calculator.php" />
</form>
And my php script which I just learn from php.net:
<?php
if ($r1a>7) {
$r2a=$r1a+1-7;
} else {
$r2a=$r1a+1;
}
?>
And the table to display all the result as per excel:
<table style="border: 1px solid black;">
<tr>
<td><?php echo $r1a; ?></td>
<td><?php echo $r2a; ?></td>
</tr>
</table>
P/S: I just put a sample table and not all as it's alot of code if put all
of code
And now the problem i receive value of r1a back instead of the value that
submitted from the html form
May I know where did I did wrong? I try to look for the tutorial for what
I want to do, but there was no tutorial for this, therefore I tried myself
and I got the error. Please advise as I'm totally new in php.
By the way this is not school project, this is a small project I want to
make for my mom to make her get the data she want easily.
Thank you so much in advance.
No comments:
Post a Comment