View Single Post
Old 10-16-2008, 11:45 AM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

You can do either PHP way, which requires the page to reload, or the JavaScript way, which doesn't. I have shown you the PHP method below, as this is the easiest way, and the best way to understand how to do it:

html4strict Code:
<form enctype="multipart/form-data" method="post">

    How many text boxes shall we show?
    <input type="text" name="iTextboxes" value="<?php echo (int) @$_POST['iTextboxes']; ?>" />
    <input type="submit" value="Generate Textboxes" />
   
</form>

php Code:
<?php if (isset($_POST['iTextboxes'])): ?>

    <?php for ($iIndex = 0; $iIndex < (int) $_POST['iTextboxes']; $iIndex++): ?>
        <input type="text" name="szTextbox[]" /><br />
    <?php endfor; ?>

<?php endif; ?>
Attached Files
File Type: php Textboxes.php (462 Bytes, 160 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote