can not display values inputed by user

ok here is a break down of what i need to do:

  1. create a form in HTML that allows user to input values (done)
  2. create a PHP page that will echo the values to the screen per input. (done)
    3)user inout # of rows and columns, user input starting values to display vertical in the columns (done)
  3. depending on user input via radio buttons, the values will either increment or decrement ( unable to get to work)

this is where i am stuck at #4

<html>
<head>
	<title>form</title>
	<style type="text/css">
body {background-color:yellow}
</style>
	
</head>
<body>
<form name="input" action="formout.php" method="post">
number of rows: <input type="text" name="rows" />
number of cells: <input type="text" name="cells" /></br>
Beginning Number: <input type="text" name="beginning" />&nbsp;
Ending Number: <input type="text" name="ending" /><br />
Skip Number: <input type="text" name="skip" /><br />
<input type="submit" value="Submit" />
</form>
</body>
</html>

this is the html form minus the radio buttons to select either increment or decrement

[php]

<?php $rows_incoming=$_POST['rows'] ; $cells_incoming=$_POST['cells'] ; $count_start=$_POST['beginning']; $count_end=$_POST['ending']; $skip=$_POST['skip']; $across_start=$_POST['across']; $across_end=$_POST['toacross']; echo ""; $starting_integer=0; for($rows=1;$rows<=$rows_incoming;$rows++){ echo ""; for($cells=1;$cells<=$cells_incoming;$cells++){ echo ""; } echo ""; } echo "
"; for ($count=$count_start+$starting_integer ; $count<=$count_end+$starting_integer ; $count++) { elseif ($count=$count_start+$starting_integer ; $count>=$count_end+$starting_integer ; $count--) { else ($count%$skip) echo "
" . $count . "
" ; } } echo "
"; ?>

[/php]

here is the PHP i am trying to work with. NO database just using $post.

So, what is the problem with radio boxes? Just go - add them! :slight_smile:

[php]<?php
if(isset($_POST[“increment”])){
if($_POST[“increment”]==1){
// do increment what you need
}
else{
// otherwise decrement
}
}
?>

Increment
Decrement
[/php]

here is the modified code im getting a parse error:

Parse error: syntax error, unexpected T_ELSE in C:\xampp\htdocs\formout.php on line 21

<html>
<head>
	<title>form</title>
	<style type="text/css">
body {background-color:yellow}
</style>
	
</head>
<body>
<form name="input" action="formout.php" method="post">
number of rows: <input type="text" name="rows" />
number of cells: <input type="text" name="cells" /></br>
Beginning Number: <input type="text" name="beginning" />&nbsp;
Ending Number: <input type="text" name="ending" /><br />
<input type="radio" name="increment" value="1"> Increment<br />
<input type="radio" name="increment" value="0"> Decrement<br />
Skip Number: <input type="text" name="skip" /><br />
<input type="submit" value="Submit" />
</form>
</body>
</html>

[php]

<?php $rows_incoming=$_POST['rows'] ; $cells_incoming=$_POST['cells'] ; $count_start=$_POST['beginning']; $count_end=$_POST['ending']; $skip=$_POST['skip']; $across_start=$_POST['across']; $across_end=$_POST['toacross']; echo ""; $starting_integer=0; for($rows=1;$rows<=$rows_incoming;$rows++){ echo ""; for($cells=1;$cells<=$cells_incoming;$cells++){ echo ""; } echo ""; } echo "
"; if(isset($_POST["increment"])){ if($_POST["increment"]==1){ for($count=$count_start+$starting_integer ; $count<=$count_end+$starting_integer ; $count++) // do increment what you need else{ ($count=$count+$starting_integer ; $count>=$count+$starting_integer ; $count--) // otherwise decrement } } echo "
" . $count . "
" ; } echo "
"; ?>

[/php]

This code make no sense, what is your goal?
[php]if(isset($_POST[“increment”])){
if($_POST[“increment”]==1){
for($count=$count_start+$starting_integer ; $count<=$count_end+$starting_integer ; $count++) // do increment what you need
else{
($count=$count+$starting_integer ; $count>=$count+$starting_integer ; $count–) // otherwise decrement
}
}
echo “
” . $count . “
” ;

}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service