CrazyEngineers
  • hi guys.
    i require some assistance of yours again.
    what i want is this:
    there is a form (say on page xyz.php) in which i have , say, 5 text-fields.
    but i also hav a button. upon clicking whihc, i want another text-field to appear.
    i do now want to use hidden fields as that would limit the number of EXTRA fields to a predefined value.
    besides, i also hav to access the data [in each of the 5 fields as well as ALL the extra fields] on the "action page" of xyz.php (say abc.php)
    javascript code shud do it but i m not able to figure it out....
    could somebody pls help me wid -
    1. dynamic text-box generation
    2. accessing these fields on abc.php for insertion into MySQL database.
    thx a lot...
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • bayazidahmed

    MemberJul 21, 2008

    let us suppose this is ur button in the BODY

    <INPUT TYPE="BUTTON" VALUE="Testing" ONCLICK="javascript:btnTesting_Click();">

    and create an extra empty DIV in the place where you want the textbox.
    <DIV ID="testDiv"></DIV>

    Now write the btnTesting_Click() in the HEAD

    <SCRIPT TYPE="text/javascript">
    function btnTesting_Click()
    {
    document.getElementById('testDiv').innerHTML = "<INPUT TYPE='TEXTBOX' NAME='txt'>"
    }
    </SCRIPT>


    Example

    <HTML>
    <HEAD>
    <SCRIPT TYPE="text/javascript">
    function btnTesting_Click()
    {
    document.getElementById('testDiv').innerHTML = "<INPUT TYPE='TEXTBOX' NAME='txt'>";
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT TYPE="BUTTON" VALUE="Testing" ONCLICK="javascript:btnTesting_Click();">
    <DIV ID="testDiv"></DIV>
    </BODY>
    </HTML>
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register