hi all,
I wonder if I could do the following task in PHP before searching for
javascript which I prefer not to have in my code:
I have a form to create new tables in a database and, since I can't
know how many columns needs each table, I want to load the page with a
single text field in the form and then with a button adding more
fields to the form if required.
so something like this:
text field
"add more fields" button
"submit" button
everytime the "add more fields" button is clicked the page reloads and
the form has another text field to enter the name of the table column.
Can be done with php instead of javascript ?
Thanks in advance for any tip
johnny 5 6532
Johnny, I'm not sure if I understand you correctly, but you can try
this:
note.. I didn't test this code, but I think this is what you're looking
for.
<?PHP
if ($_POST['Submit'])
{
$field = $_POST['field'];
for ($i = 0; $i < count($field); $i++)
{
// echo all results
echo $field[$i] ."<br />\n";
}
}
else
{
// $fc = field count
$fc = $_POST['fc'];
if (!is_numeric($f c) || $fc == "")
{
// if fc isn't set - default it to 1
$fc = 1;
}
if ($_POST['AddField'])
{
// if AddField button was clicked - increment $fc
$fc++;
}
?>
<form action="<?PHP echo $_SERVER['PHP_SELF'];?>" method="post">
<?PHP
for ($i = 1; $i <= $fc; $i++)
{
echo "<input type=\"text\" name=\"field[". $i ."]\"
value=\"\"><br />\n";
}
?>
<input type="submit" name="AddField" value="add more fields">
<input type="submit" name="Submit" value="submit">
<input type="hidden" name="fc" value="<?PHP echo $i;?>">
</form>
<?PHP
}
?>
"johnny" <mr********@yah oo.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com... hi all,
I wonder if I could do the following task in PHP before searching for javascript which I prefer not to have in my code:
I have a form to create new tables in a database and, since I can't know how many columns needs each table, I want to load the page with a single text field in the form and then with a button adding more fields to the form if required.
so something like this:
text field "add more fields" button "submit" button
everytime the "add more fields" button is clicked the page reloads and the form has another text field to enter the name of the table column.
Can be done with php instead of javascript ?
Thanks in advance for any tip
johnny
Seems pretty straightforward and yes, PHP can handle everything including
validation.
I would simply have a form with a single input and submit button. Every time
an entry is submitted, the page refreshes displaying the same form followed
by the list of previously entered values. The form is always at the top of
the page for convenience. You should also inform the user the table creation
table was successful.
Bosconian wrote: "johnny" <mr********@yah oo.com> wrote in message news:11******** *************@g 14g2000cwa.goog legroups.com... I have a form to create new tables in a database and, since I can't know how many columns needs each table, I want to load the page with a single text field in the form and then with a button adding more fields to the form if required.
Seems pretty straightforward and yes, PHP can handle everything including validation.
I would simply have a form with a single input and submit button. Every time an entry is submitted, the page refreshes displaying the same form followed by the list of previously entered values. The form is always at the top of the page for convenience. You should also inform the user the table creation table was successful.
Only now did I notice that johnny wants to create tables.
johnny, unless you have a good reason to let users create tables:
Don't do that.
Don't allow users to create tables.
Create all the tables you need before making your script available.
--
If you're posting through Google read <http://cfaj.freeshell. org/google>
"Pedro Graca" <he****@dodgeit .com> wrote in message
news:sl******** ***********@ID-203069.user.ind ividual.net... Bosconian wrote: "johnny" <mr********@yah oo.com> wrote in message news:11******** *************@g 14g2000cwa.goog legroups.com... I have a form to create new tables in a database and, since I can't know how many columns needs each table, I want to load the page with a single text field in the form and then with a button adding more fields to the form if required.
Seems pretty straightforward and yes, PHP can handle everything
including validation.
I would simply have a form with a single input and submit button. Every
time an entry is submitted, the page refreshes displaying the same form
followed by the list of previously entered values. The form is always at the top
of the page for convenience. You should also inform the user the table
creation table was successful.
Only now did I notice that johnny wants to create tables.
johnny, unless you have a good reason to let users create tables: Don't do that. Don't allow users to create tables. Create all the tables you need before making your script available.
-- If you're posting through Google read <http://cfaj.freeshell. org/google>
I complete agree. I assume this was some sort of admin tool and not for
public consumption.
sorry, I forgot to reply, thanks Adam, this is what I had to do.
For Bosconian and Pedro , yes it's part of an admin tool to create and
manage contact lists, each list has its own table.
johnny This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anand |
last post by:
Hi i am having trouble adding a recordset into the access database,
the code seems to be working fine it passs and parses through all
variables just fine without showing any errors and also when i access
the recordset it displays the results, what the real issue is that the
entry is not made into the database even though i use the Update
command and i have also tried the BeginTrans and CommitTrans nothign
seems to work and i am unable to...
|
by: Bobbak |
last post by:
Hello All,
I have these tables (lets call it ‘EmpCalls', ‘EmpOrders', and
‘Stats') that each contain the list of EmployeeIDs, I want to be able
to create a Module in which I could call in my VB form (by clicking
and command button)that will add a column (field) to each table and
label it with the current date that is specified in my form. Does
anyone know how I can go about doing this?
Any suggestion will be greatly appreciated.
|
by: Tony D. |
last post by:
I could really use some help with a problem I am having. I am trying
to add a new field to an existing form that combines two tables into
one form. In this same databse I have another form that exists off of
1 table and when I add a new field into the table I have no problem
adding into the corresponding form. However when I add a new field to
one of the following tables:
- Employee List & Main Profile tables (This is what the combined...
|
by: Randy A. Bohannon |
last post by:
This is probably a simple thing to do, but I can't find how in the help
files or the manual I have.
I'm using Access 2000. I have three tables joined by a common field, and
I'm using one form to enter data into all of them. The form was created
using the form wizard. I need to add new fields to one of the tables, and
consequently, to the form. I can add the fields to the table, but not to
the form. I've done this before with a form...
|
by: RC |
last post by:
I have an Access 2002 database with many tables and forms (but just to
keep things simple, let's say the DB has one Table "Table1" and one
Form "Form1").
I have managed to cobble together so much complex code to add records
and edit records I need to step back and ask you all what is the
proper way to do this. The database is DAO. The table has Columns
SerialNumber, CPU, HardDrive and Model. I am trying to use a Form to
fill out the...
| |
by: brenda.stow |
last post by:
error msg " An error occured while referencing the object. You tried to
run a visual basic procedure that improperly references a property or
method of an object"
This msg occurs everytime I add a new record to a subform. If I close
msgbox I can then successfully add new record.
Have looked on MS Technet and tried their 2 suggestions:-
1)LinkChildFields property contains the name of a form property - this
isn't the case linkChildFields...
|
by: sara |
last post by:
Hi -
I have 2 new questions in a new database I'm trying to develop.
The first has 6 fields on a table and allows the user to enter them on
a form. The form is bound to the table.
All 6 fields are default value = 0 on the table and on the form.
Fields are filled in at different times and maybe by different people,
so I wanted them all to "initialize" to 0.
|
by: vivekvt |
last post by:
--------------------------------------------------------------------------------
here is the code to the asp page that adds data to the access database!
<html>
<body>
<%
Dim recordsaffected
|
by: omerbutt |
last post by:
AJAX PROB WITH MULTIPLE RECORDS
helo iam having problem in ma code will any body look out an help, i am trying t add sale record in the database and the checkthe quantity of the part slod and decrement it to the current quantity for example if tehre is a part woth part no 10023 and its quantity in show room is 20 and total quantity is 25 then if there is a sale of 2 parts then i have to add the sale and decrement the current quantity in the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |