Page 1 of 1

change fields name in table

Posted: Thu Sep 18, 2008 10:14 am
by kabucek
hello,

I have issue with my php configuration file.
There are 2 forms with some fields.
1 is for "member data" and second for "club info"
here are the parts of the code:

1part)

Code: Select all

$fieldName="city"; $customLabel="City";                         if ($errorArray[$fieldName]) {$customLabel="$customLabel*<BR><SPAN class=errorLabel>".$errorArray[$fieldName]."<P></SPAN>"; }                       $formFormatArray['labelOverride']=$customLabel; $tagName=$fieldName."TAG";                      $$tagName=$classLink->getFormTag($fieldName, $$dataArrayName, $formFormatArray);                        if ($errorArray[$fieldName] AND $formFormatArray['cssTagClassError']) {$$tagName=str_replace($formFormatArray['cssTagClass'], $formFormatArray['cssTagClassError'], $$tagName); }                       $$targetString.=$$tagName;



2nd part)

Code: Select all

<tr valign='top' bgcolor='#FFFFFF'>                               <td  width='105' height='26' align='left' class='paragraphbold'><div align='right'>City<font face='Arial, Helvetica, sans-serif' size='1' color='red'><em>*</em></font>{$errorArray["city"]}</div></td>                              <td height='26'><input name='recordDataArray[city]' value='{$recordDataArray['city']}'  type='text' size='55'>                              </td>                           </tr>



Those codes are in our reg-test.php file
user told me that they want more fields to be displayed on their management web interface,
so I went to another file listmem.php and add
this code that allows to see the Club address:

Code: Select all

$title="";                                  $fieldString.="                                         <TD $fieldStyle>                                            <NOBR>{$itemRecArray['street']} {$itemRecArray['city']} {$itemArray['state']} {$itemArray['zip']} $errorFlag</NOBR>                                             </TD>                                       ";                                      $fieldTitleString.="                                            <TD $fieldTitleStyle>                                               Club Address                                                </TD>                                           ";                                      $fieldCount++;  



- but this is not working because there is previous form with the same field names in
reg-test.php file and its picking up all the time city from the previous form. - where the member lives and
not the club city.
Any help or suggestions?
thanks

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:18 am
by Jade
Did you give those different names from the other fields? If they all have the same names that might be causing the problem. (IE two state fields)

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:23 am
by kabucek
previous coder put the same names for these 2 different forms and that's why its mess with
the registrations.
I'm looking for a way to rename fields from the second form (club..)
thanks

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:29 am
by Jade
np :)

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:33 am
by kabucek
you mean not possible ??

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:49 am
by Jade
Of course it's possible. You need change the names of the array fields wherever the club information is being stored.

Code: Select all

 
$title="";
$fieldString.="<TD $fieldStyle><NOBR>{$itemRecArray['club_street']} {$itemRecArray['club_city']} {$itemArray['club_state']} {$itemArray['club_zip']} $errorFlag</NOBR></TD>";                                      
$fieldTitleString.=" <TD $fieldTitleStyle>Club Address                                              </TD>";
$fieldCount++;
 
Then wherever this information is being stored/or loaded for the first time you need to make sure it goes into the same array variables.

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:53 am
by kabucek
ok this will work only to the new registrations,
but what about the old registrations?
i want to view the data from the old registrations.

Re: change fields name in table

Posted: Thu Sep 18, 2008 10:58 am
by Jade
Yes, it will work. All you have to do is make sure what's being pulled from the database/file (whatever you're using to store this data) loads the appropriate information into those fields. It doesn't matter if the data is being stored with another name as long as you load it in correctly and then save it back correctly.