tgavin Posted March 4, 2007 Share Posted March 4, 2007 I have two functions; one for processing posted data, and one for displaying a textfield in the page. The process function processes the POSTed form data. If the textfield is supposed to be an integer, then I want to make the background red and display a message indicating that there is invalid data with that particular textfield. This is no problem. What is the problem is figuring out a way to pass a variable (or whatever) from the post function to the textfield function (after the form has been submitted), telling the textfield function to make the background red. Each variable has to have a unique name, as there are over 90 form elements on the page. If I set only one error var, then every textfield will have a red background. Unique naming is the key. The form element name plus '_err' is probably the way to go (ie; fname_err). I'm thinking variable variable, but I've been playing with this for a couple of days and am afraid I've run out of ideas. Any ideas would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/41176-solved-passing-unique-error-var-from-one-function-to-another/ Share on other sites More sharing options...
tgavin Posted March 5, 2007 Author Share Posted March 5, 2007 Got it. I wasn't setting my variable variable correctly ${$name.'_err'} = 0; // init & set the variable variable value to zero Link to comment https://forums.phpfreaks.com/topic/41176-solved-passing-unique-error-var-from-one-function-to-another/#findComment-199947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.