0

If it is not an array, I can just enter like below

<input value="{{old('name','ali')}}">

so the default value will display ali

But when it old('name') is an array, how can i write my default value like the previous one to, or i can only use isset() to check?

<input value="{{old('name')[$i]}}">

1 Answer 1

0

i'm not sure is there any other solution. But, please try this:

{{@old('name')[$i]}}

(add @ before)

Sign up to request clarification or add additional context in comments.

4 Comments

but this code does not put ali as my default value
@Zachary how about ` old("name[$i]", $default) `
this will have the default value, but the old value it not working because it is an array
@Zachary did you try ` old("name.$i", $default)`. I get it here: stackoverflow.com/questions/42050732/old-input-for-array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.