| | |
dynamic form generation in PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 46
Reputation:
Solved Threads: 0
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...
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...
this is one type:
php Syntax (Toggle Plain Text)
<script> function Add() { </script> <td width="300" ><input type="text" name="txt_prodid[]" class="border" size="25" /></td> <td width="200" colspan="2"><input name="txt_proddescription[]" type="text" class="border" size="36" /></td> <td width="200"><input type="text" name="txt_prodquantity[]" size="20" class="border" /></td> <script> } </script> <form name="pr_form" action="pr_add.php" method="post" onSubmit="return validateForm();"> <tr width="508" align="center"> <td colspan="2" align="right"><input name="Product" type="submit" value="Add Product" class="buttonSubmitMedium" onClick="Add();"></td>
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
The way I understand it, you want to have new textboxes appear due to an onClick event attached to a button. If that is incorrect, please clarify the post a bit.
To proceed with my understanding, let me preface: You will not need PHP to accomplish this task. A little CSS and Javascript will do the trick.
To proceed with my understanding, let me preface: You will not need PHP to accomplish this task. A little CSS and Javascript will do the trick.
html Syntax (Toggle Plain Text)
<html> <!-- CSS Declaration --> <head> <style type="text/css"> /* Sets class for the text box with a hidden property */ .hide { display:none; } /* Sets class for the text box with a visible property */ .show { display:block; } </style> </head> <body> <input type="button" value="Show" onclick="document.getElementById('MyBox').className='show';" /> <input type="button" value="Hide" onclick="document.getElementById('MyBox').className='hide';" /> <br /> <br /> <!-- Hide and Show this DIV with the buttons above --> <div id="MyBox" class="hide"> <input type="text" name="TextBoxName" /> </div> </body> </html>
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
![]() |
Similar Threads
- Dynamic Generation and Input (PHP)
- PHP Dynamic Form HELP! (PHP)
- dynamically update pages (HTML and CSS)
- Microsoft .NET FAQ (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: security using cookies/session variables
- Next Thread: how to attach more than one files with php? can anyone help me?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parse paypal pdf php problem query radio random recursion regex remote script search send seo server sessions sms soap source space sql static structure syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube






