<p>All related fields need to be passed as an array even if it is limited to 1.</p>

<p>so for example change your eventBooking and userBooking hidden fields to be the following (also you may need to specify the user id when relating to a user):</p>

<pre><code>&lt;input type="hidden" name="fields[userBooking][]" value="{{user.id}}"&gt;
&lt;input type="hidden" name="fields[eventBooking][]" value="{{eventID}}"&gt;
</code></pre>

<p>This should get you want you need.</p>

CC BY-SA 3.0
2014-08-07T13:25:50.460Z
No worries, enjoy!
nfourtythree
CC BY-SA 3.0
2014-08-07T10:27:00.860Z
2014-08-07T10:27:00.860Z
nfourtythree
<p>I've got a 'booking' channel and an 'event' channel setup. Through the frontend, I need the logged in user to be able to submit a saveEntry form on the frontend which saves a new entry in the booking channel. The booking channel has two fields, both Entries fields. The first field is a relation to one user (the logged in user), and the second field is a relation to a single entry in the events channel.</p>

<p>When I submit the form, the entry is being created in the booking channel, both both Entries fields are blank. How do I make it save the related entries? Can't find any documentation on it.</p>

<p>Existing code:</p>

<pre><code>&lt;h2&gt;Summary&lt;/h2&gt;
&lt;form method="post" action="" accept-charset="UTF-8" class="custom"&gt;
    &lt;input type="hidden" name="action" value="entries/saveEntry"&gt;
    &lt;input type="hidden" name="redirect" value="events/{{event.slug}}"&gt;
    &lt;input type="hidden" name="sectionId" value="18"&gt;
    &lt;input type="hidden" name="enabled" value="1"&gt;
    &lt;input type="hidden" name="fields[userBooking]" value="{{user.username}}"&gt;
    &lt;input type="hidden" name="fields[eventBooking]" value="{{eventID}}"&gt;
    &lt;input type="submit" value="Confirm Booking"&gt;
&lt;/form&gt;
</code></pre>

<p>Short version: How do I save a related entry through a frontend form?</p>

<entries><form>
How to save Entries to an entry? (non-plugin)
# How to save Entries to an entry? (non-plugin)

(Asked by: username_0 on 2014-08-07)

I've got a 'booking' channel and an 'event' channel setup. Through the frontend, I need the logged in user to be able to submit a saveEntry form on the frontend which saves a new entry in the booking channel. The booking channel has two fields, both Entries fields. The first field is a relation to one user (the logged in user), and the second field is a relation to a single entry in the events channel.
When I submit the form, the entry is being created in the booking channel, both both Entries fields are blank. How do I make it save the related entries? Can't find any documentation on it.
Existing code:
Summary

    
    
    
    
    
    
    


Short version: How do I save a related entry through a frontend form?

**Tags:** entries, form


---

## 1 answers

### Answer by username_1 on 2014-08-07. Score: 4 | Accepted answer

All related fields need to be passed as an array even if it is limited to 1.
so for example change your eventBooking and userBooking hidden fields to be the following (also you may need to specify the user id when relating to a user):



This should get you want you need.

> **Comments:**
> **username_1**: No worries, enjoy!  

---

