PHP and HTML problem

Started by
2 comments, last by RuneLancer 19 years, 11 months ago
Yeah, this isn''t game-related, but i figure it''d be the best way to get an answer anyhow. Sorry. The basic interface is this: the user has a couple of fields to fill in, as well as a + button and a - button, both of which either add or remove a field in a table (yes, the kind with the tr and td tags) via insertRow and insertCell. At the bottom of the screen, I have a "update" button which is supposed to grab all of the data entered and stuff it into an SQL table. How would I go about doing this? I know I can use a form (again, the tag < form >) to pass data using POST or GET, but I''ve only passed data from controls that were clearly identified before. For instance...
<form>
  <input name=UserID type=text maxlength=20/>
  <input type=submit value="blah"/>
...Which I can''t do, since I''m adding and deleting fields in the table. Unless there''s a way to create unique names for every field and have the script handling the POST know how many fields I have to deal with...?
Advertisement
Any ideas...?

This is to implant the data-editing part of a college project (not actually homework; more like furthering my knowledge of PHP and javascript, but to boot I get extra credit. which is sweet.). The rest works fine, but I wouldn''t mind a push in the right direction for this, because I''m completely stumped and can''t seem to find anything on this.
You could just count up the number of fields that had been added, naming each filed something simple, such as "field1", "field2", etc. when they''re created, then pass that count to your update function so it knows how many controls to grab values from.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

How would I go about doing this? Like I said, I know how to pass data via POST and GET, and with session variables, but the former doesn''t apply to this and the latter seems wasteful.

Unless I''d make an invisible field and put the value in it. Sounds wasteful too but... I guess I could try that...

This topic is closed to new replies.

Advertisement