Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RuneLancer

PHP and HTML problem

This topic is 5309 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!