Jump to content

create fields based on array?


turpentyne

Recommended Posts

Looking for tutorials, but maybe the forum's quicker. Can anybody give me a loose idea how to do this?

 

I have a sequence of pages that the user goes through to enter information. I need to move a page up to pull data before inputting to the database - to prevent some dropped entries and errors.

 

Before, it was using info in the database to loop through and generate data. I want to do it just based on the info in an array:

 

I want array(217 => 1, 215 => 2); to loop generate a form that loops through to create something like:

<form>
Student one, Class 217<br>
First name: <input type="text" name="fname[]" id="fname" onfocus="this.className='reg_live';" onblur="this.className='reg_off';" />
Last name: <input type="text" name="fname[]" id="fname" onfocus="this.className='reg_live';" onblur="this.className='reg_off';" />

<br><hr><br>

Student one, Class 215<br>
First name: <input type="text" name="fname[]" id="fname" onfocus="this.className='reg_live';" onblur="this.className='reg_off';" />
Last name: <input type="text" name="fname[]" id="fname" onfocus="this.className='reg_live';" onblur="this.className='reg_off';" />

<br><br>

Student one, Class 215<br>
First name: <input type="text" name="fname[]" id="fname" onfocus="this.className='reg_live';" onblur="this.className='reg_off';" />
Last name: <input type="text" name="fname[]" id="fname" onfocus="this.className='reg_live';" onblur="this.className='reg_off';" />

<br><hr><br>
and so on.

<input type="submit" value="Register" /></form>


 

 

Link to comment
https://forums.phpfreaks.com/topic/259462-create-fields-based-on-array/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.