Login | Register | FAQ
Anonymous

my code is not working

+ Post a reply

2 posts Page 1 of 1


my code is not working

by omatthew » Sun Nov 06, 2016 11:06 pm

pls can anyone help me figure out why my code is not working, am try to create a simple multiplication table with php loop, and i use $_post[''] to get the what people enter from my html form. but it does not seems to work. below are my codes pls is there anything am messing?


<html>

<head>
<title>Matthew</title>


<?php

$times=2;

if(isset($_post['submit1'])) {

$start= $_post['textstart'];
$end= $_post['textend'];
$times=$_post['texttimes'];

for($start; $start<=$end; $start++) {
$answer= $start * $times;
print $start. "multiply by" . $times . "=" . $answer . "<br/>";


}
}

?>


</head>



<body>

<form name="matthewform" method= "post" action= "matthew.php">


Enter Start Number <input type ="text" name="textstart" size= "5" value="1">
Enter End Number <input type ="text" name ="textend" size= "5" value= "10">
Multiply By <input type= "text" name= "texttimes" size= "5" value= <?php print $times;?>> <br/><br/>
<input type="submit" value="Calculate" name="submit1">

</form>




</body>



</html>







have try different method in using $_post [''] to get information from what people enter in my form but non of them work form me with $_post ['']
User avatar

omatthew

  • Posts: 1
  • Joined: Sun Nov 06, 2016 10:56 pm

Re: my code is not working

by Farhin Qureshi » Tue Jan 24, 2017 12:21 pm

Hi,
you have made many mistakes in your code which has been corrected below:
Code: Select all
<html>

<head>
<title>Matthew</title>


<?php

$times=2;

if(isset($_post['submit1'])) {

$start= $_post['textstart'];
$end= $_post['textend'];
$times=$_post['texttimes'];

for($start; $start<=$end; $start++) {
$answer=1;
$answer= $start * $answer;
print $start. "multiply by" . $end . "=" . $answer . "<br/>";


}
}

?>


</head>



<body>

<form name="matthewform" method= "post" action= "matthew.php">


Enter Start Number <input type ="text" name="textstart" size= "5" value="1">
Enter End Number <input type ="text" name ="textend" size= "5" value= "10">
Multiply By <input type= "text" name= "texttimes" size= "5" value= <?php print $answer;?>> <br/><br/>
<input type="submit" value="Calculate" name="submit1">

</form>




</body>



</html>




User avatar

Farhin Qureshi

  • Posts: 45
  • Joined: Tue Jan 03, 2017 11:33 am
--
Farhin Qureshi
.NET Developer
http://www.ifourtechnolab.com


+ Post a reply

Page 1 of 1

cron