dimanche 4 février 2018

Laravel form inputs missing from request

I have the following form:

<form action="" method="post">
    <fieldset>

        <div>
            <input id="block--page-id" name="page_id" type="text" disabled value="">
            <lable for="block--page-id">Page ID</lable>
        </div>

        <div>
            <input id="block--name" name="name" type="text">
            <label for="block--name">Name</label>
        </div>

        <div>
            <input id="block--description" name="description" type="text">
            <label for="block--description">Description</label>
        </div>

        <div>
            <input id="block--key" name="key" type="text">
            <label for="block--key">Key</label>
        </div>

        <div>
            <textarea id="block--value" name="value">
            </textarea>
            <label for="block--value">Value</label>
        </div>

        <div>
            <button type="submit">Create</button>
        </div>

        
    </fieldset>

With the following controller:

public function blocksStore(Request $request, $pageId)
{
    $block = new PageBlock();

    $block->page_id = $request->input('page_id');
    $block->name = $request->input('name');
    $block->description = $request->input('description');
    $block->key = $request->input('key');
    $block->value = $request->input('value');

    $block->save();
    return redirect('admin.pages.edit', [$pageId]);
}

However, my input for page_id doesn't get passed into the request. All the other inputs work fine so I'm unsure of what else could be wrong.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire