How can I migrate from insert_custom_cform to insert_cform
-
Hi,
so we’re using a really old version of cforms (11.7.3) and now need to upgrade to a newer version since we are upgrading to PHP7.
I tried at least 10 different versions an I either have the issue that insert_custom_cform is not working or that the version I tested is not fully compatible with PHP 7 (giving errors when submitting a form).
So the only option I have is rebuild the forms with a new version running on PHP7
So insert_custom_cform is no longer supported and whenever I use insert_cform I’m getting either a blank form or having issues with the way the form is calling it’s fieldnames (not using the number of form properly in tags ids and classes, therefore messes up other parts of my code).
Here is my old code:
<? $fields = array(); $formdata = array( array('Contact Information','textonly',0,0,0,0,0), array('First Name','textfield',0,1,0,0,0), array('Last Name','textfield',0,1,0,0,0), array('Your Address','textfield',0,1,0,0,0), array('Your City','textfield',0,1,0,0,0), array('Your State#...|...#Alberta|AB#Alaska|AK#Alabama|AL#Arkansas|AR#Arizona|AZ#British Columbia|BC#California|CA#Colorado|CO#Connecticut|CT#District Of Columbia|DC#Delaware|DE#Florida|FL#Georgia|GA#Hawaii|HI#Iowa|IA#Idaho|ID#Illinois|IL#Indiana|IN#Kansas|KS#Kentucky|KY#Louisiana|LA#Massachusetts|MA#Manitoba|MB#Maryland|MD#Maine|ME#Michigan|MI#Minnesota|MN#Missouri|MO#Mississippi|MS#Montana|MT#New Brunswick|NB#North Carolina|NC#North Dakota|ND#Nebraska|NE#New Hampshire|NH#New Jersey|NJ#Newfoundland and Labrador|NL#New Mexico|NM#Nova Scotia|NS#Northwest Territories|NT#Nunavut|NU#Nevada|NV#New York|NY#Ohio|OH#Oklahoma|OK#Ontario|ON#Oregon|OR#Pennsylvania|PA#Prince Edward Island|PE#Puerto Rico|PR#Quebec|QC#Rhode Island|RI#South Carolina|SC#South Dakota|SD#Saskatchewan|SK#Tennessee|TN#Texas|TX#Utah|UT#Virginia|VA#Vermont|VT#Washington|WA#Wisconsin|WI#West Virginia|WV#Wyoming|WY#Yukon Territory|YT','selectbox',0,1,0,0,0), array('Zip Code','textfield',0,1,0,0,0), array('Your Phone','textfield',0,1,0,0,0), array('Your E-Mail','textfield',0,1,1,0,0), array('Vehicle Donation Information','textonly',0,0,0,0,0), array($allkids,'selectbox',0,1,0,0,0), array('Year','textfield',0,1,0,0,0), array('Make','textfield',0,1,0,0,0), array('Model','textfield',0,1,0,0,0), array('Mileage','textfield',0,0,0,0,0), array('Vehicle VIN','textfield',0,0,0,0,0), array('Vehicle Location','textonly',0,0,0,0,0), array('Same as above','checkbox',0,0,0,0,0), array('Vehicle Location Address','textfield',0,0,0,0,0), array('City','textfield',0,0,0,0,0), array('State#...|...#Alberta|AB#Alaska|AK#Alabama|AL#Arkansas|AR#Arizona|AZ#British Columbia|BC#California|CA#Colorado|CO#Connecticut|CT#District Of Columbia|DC#Delaware|DE#Florida|FL#Georgia|GA#Hawaii|HI#Iowa|IA#Idaho|ID#Illinois|IL#Indiana|IN#Kansas|KS#Kentucky|KY#Louisiana|LA#Massachusetts|MA#Manitoba|MB#Maryland|MD#Maine|ME#Michigan|MI#Minnesota|MN#Missouri|MO#Mississippi|MS#Montana|MT#New Brunswick|NB#North Carolina|NC#North Dakota|ND#Nebraska|NE#New Hampshire|NH#New Jersey|NJ#Newfoundland and Labrador|NL#New Mexico|NM#Nova Scotia|NS#Northwest Territories|NT#Nunavut|NU#Nevada|NV#New York|NY#Ohio|OH#Oklahoma|OK#Ontario|ON#Oregon|OR#Pennsylvania|PA#Prince Edward Island|PE#Puerto Rico|PR#Quebec|QC#Rhode Island|RI#South Carolina|SC#South Dakota|SD#Saskatchewan|SK#Tennessee|TN#Texas|TX#Utah|UT#Virginia|VA#Vermont|VT#Washington|WA#Wisconsin|WI#West Virginia|WV#Wyoming|WY#Yukon Territory|YT','selectbox',0,0,0,0,0), array('Zip','textfield',0,0,0,0,0), array('Does this vehicle run?','checkbox',0,0,0,0,0), array('Additional Information','textonly',0,0,0,0,0), array('How did you hear about us?#Google Search#Yahoo Search#Bing Search#Radio#Newspaper#Post Card#Thrift Store Flyer#Previous Donor#Other','selectbox',0,1,0,0,0), array('Message','textarea',0,0,0,0,0), array('User||^[\s]*$|err:No Spam please','textfield',0,0,0,0,0), array('Have Pics? Attach them here.','upload',0,0,0,0,0), array('<a href="#" id="addScnthome">Add More</a>','textonly',0,0,0,0,0) ); $i=0; foreach ( $formdata as $field ) { $fields['label'][$i] = $field[0]; $fields['type'][$i] = $field[1]; $fields['isdisabled'][$i] = $field[2]; $fields['isreq'][$i] = $field[3]; $fields['isemail'][$i] = $field[4]; $fields['isclear'][$i] = $field[5]; $fields['isreadonly'][$i++] = $field[6]; } insert_custom_cform($fields,'8'); ?>
How would I call this form and data properly using the insert_cform function?
Thanks a lot for the help.
- The topic ‘How can I migrate from insert_custom_cform to insert_cform’ is closed to new replies.