im in a bit of a trouble
i have a drop down list which contains various items,on selection of one of a item,a text box and submit button appears,for this i have used javascript and div tag.now i want to enter the no in that text box and on submitting the number of textbox has to appear on that page,how can i do it?

Recommended Answers

All 3 Replies

Anuran,

Post your html/javascript so we can see what you have thus far.

Airshow

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <LINK REL="SHORTCUT ICON" HREF="Burn.ico">
        <style type="text/css">
html {height:100%;}
body {height:100%; margin:0; padding:0;}
#el08 {font-family:"Viner Hand ITC";font-size: .8em;font-weight: bold;
    text-decoration: underline;
text-transform: uppercase;}
#e105{font-family:"Viner Hand ITC"; color:cornsilk}
#e100{font-family:"Viner Hand ITC"; color:lawngreen;}
#bg {position:fixed; top:0; left:0; width:100%; height:100%;}
#content {position:relative; z-index:1;}
#aa{border-width:5px dotted thin;}
#t2{text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(0,0,0,0.25);
        padding:8px;
    background:#D1E231;
    color:#000;
    margin-bottom:5px;
    font-weight:bold;
    -moz-border-radius: 6px;
         font-family:Viner Hand ITC;
    -webkit-border-radius: 6px;
    -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
    -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
    text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
}
</style>
        <script type="text/javascript">

function fill()
{
    <?php $x=$_POST['t1'];
    for($i=0;$i<$x;$i++)
    {?>

            document.getElementById('id.<?php $i ?>').innerHTML="<input type=\"text\" name=\"tt<?php $i ?>\" value=\"\" />"
     <?php }?>
}
 </script>
        <title>events</title>
    </head>
    <body vlink="#171717"><img src="tiger.jpg" width="100%" height="100%" id="bg" >
        <?php if(isset($_POST['sbmt1']))
        {}
        else{?>
        <div id="content">
        <form name="f2" action="<?php $PHP_SELF ?>" method="POST" onsubmit="fill()">
            <marquee><h1><font face="Viner Hand ITC"  color="#171717" id="t2"><b><u>Event Registration</u></b></font></h1></marquee>
            <fieldset id="aa" style="width:250;background-color:transparent">
                <fieldset id="e105"><legend>Event</legend>
                    <select name="event" style="font-family:Viner Hand ITC" >
                        <option value="AR">Aarohan</option>
<option value="AV">Abhivyakti</option>
<option value="BK">Bakwaas Band Kar</option>
<option value="BS">Brain Strain</option>
<option value="CB">Clash of Bands</option>    
<option value="CO">Co-Op</option>
<option value="DB">Dabangg - a la Roadies</option>
<option value="FO">Flagg Off!</option>
<option value="GA">Game Arcade</option>
<option value="HZ">Hostile Zone</option>
<option value="LM">Laws of Motion</option>
<option value="MS">Moving Soccer</option>
<option value="TN">Moving Soccer</option>
                    </select>
                </fieldset>
                <fieldset><legend id="e105">No of Mem</legend>
                <input type="text" name="t1" value="" />
                <br><input type="submit" value="ok" name="sbmt1" id="el08" onclick="fill()"/>
            </fieldset></fieldset>
        </form></div>
        <?php for($i=0;$i<12;$i++){?>
        <div id="id.<?php $i ?>"></div>
        <?php } ?>
        <?php } ?>
    </body>
</html>

This appears to be a 2-page exercise but you are trying to code everything on one page which is served twice. This can be done but is rather a complex approach.

It will be much easier to either:

  • Use one page and handle everything client-side with javascript (no PHP necessary)
  • Use two pages (the first page needs javascript and the second page needs PHP).

It's hard for me to advise as I don't know what constraints you are working under.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.