Pass Data To Form on Another Page

Posted 2 months ago by Xerakon

I am attempting to essentially pass a variable from one page url to another to assist in filling out a form.

I have a Script model and a Prescription model. Each script can have multiple prescriptions. So on the Scripts show page, I'm wanting to have a create button that allows users to click it, and it sends them to the Prescriptions create page, but auto-fills out the script_id for the user in the controller. This way it is definitively tagged to the correct script.

So if someone clicks on 'Create Prescription' on test.com/scripts/34, it takes them to test.com/prescriptions/create and automatically applies 34 as the script_id field - ideally either a hidden field, or directly passed to the controller somehow so that the user can't tamper with it.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.