how do I code for n times

Hi What I need to do is the user types in a sentence and a number and the sentence will be displayed the amount of the number the user inputted. I do have the sentence displaying but I can't figure out how to make is display x amount of times. Please advise. Thank you in advance. :o
<h2 style="text-align: center">Q4 Form</h2>
<form name="Q4" action=
	"process_Q4.php"
	 method="post">
<p>Sentences: <input type="text" name="wSentence" /></p>
<p>Number: <input type="text" name="anumber" /></p>
	 
	 
 <p><input type="reset" value="Clear Form" />&nbsp;
&nbsp;<input type="submit" name="Submit" value=
"Send Form"/></p>
</form>

<html>
<?php

	$sentences = $_POST['wSentence'];
	$number = $_POST['anumber'];
	echo "Is this the sentence you typed,
	".$sentences."".$number.".";
	

?>

<html>

I think what you’re looking for is a loop no?

http://w3schools.com/php/php_looping_for.asp

[php]<?php

$sentences = $_POST['wSentence'];
$number = $_POST['anumber'];
for($n=$number;$n < 5; $n++){               
     echo "Is this the sentence you typed,
     ".$sentences."".$number.".";
    }

?>[/php]

Hope this helps! =]

Sponsor our Newsletter | Privacy Policy | Terms of Service