•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,667 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,927 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 124 | Replies: 1
![]() |
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
php Syntax (Toggle Plain Text)
<? $c = $_POST['col']; $r = $_POST['rw']; ?> <? for($cvchk = 1; $cchk<= $c; $cchk ++) { echo $cchk."<br>"; for($rchk = 1; $rchk<= $r; $rchk ++) { echo $rchk." "; } } ?>
i want the output to become this one
1 2 3 4
2 3 4 1
3 4 1 2
4 1 2 3
i really kinda new with this thanks a lot guys
guys can you help me out with this one..
Last edited by peter_budo : Mar 30th, 2008 at 4:48 am. Reason: [icode] is for one line of code, [code] is for multiple lines
•
•
Join Date: Feb 2008
Location: Gurgaon India
Posts: 64
Reputation:
Rep Power: 1
Solved Threads: 9
Your answer
<?
$c = $_POST['col'];
$r = $_POST['rw'];
?>
<?
for($cchk = 1; $cchk<= $c; $cchk ++)
{
echo $cchk."";
for($rchk = 1; $rchk<= $r; $rchk ++) {
if ($rchk > $cchk){ echo $rchk; }
}
for($rchk = 1; $rchk<= $r; $rchk ++)
{
if ($rchk < $cchk){ echo $rchk; }
}
echo "<br> ";
}
?>![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- What do ya guys think about Dual monitors? (Techies' Lounge)
- You Guys Play Videogames? (Geeks' Lounge)
- ok guys,here is what i reached...c++ (C++)
- Any cases you guys know of that have a dual-ported powersupply slots? (Cases, Fans and Power Supplies)
- Hey guys can anybody help me (Geeks' Lounge)
- plz help me out guys!!!!!!!! (C)
- Can you guys help me? about Quick Sort Algorithm (C)
Other Threads in the PHP Forum
- Previous Thread: wth?
- Next Thread: javascript function


Linear Mode