Support the ongoing development of Laravel.io →
Input Database Eloquent
Last updated 1 year ago.
0

After banging my head against a wall, I have FINALLY google the correct terms and found a solution. http://stackoverflow.com/questions/8288414/php-appending-strin...

So now it looks like this:

$b=1;
while($b<16) {
	for($a=1;$a<=8;$a++) {
		if(!empty(Input::get('findingA-1-'.$a))) $exam->{'findingA-'.$b} = Input::get('findingA-1-'.$a);
		$b++;
		if(!empty(Input::get('findingA-1-'.$a))) $exam->{'findingA-'.$b} = Input::get('findingA-2-'.$a);
		$b++;
	}
}

Just had to add curly braces

$exam->{'findingA-'.$b}

Leaving this for anyone who's had a similar problem

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

rginnow rginnow Joined 5 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.