# Add events to your website (/docs/guides/website-registration)



Your form collects the attendee’s details. Your backend creates their ticket.

<DocsFlow label="Registration" steps="[&#x22;Your form&#x22;, &#x22;Your backend&#x22;, &#x22;Attendee + ticket&#x22;]" />

Start with an event from the [quickstart](/docs/quickstart).

## 1. Collect a name and email [#1-collect-a-name-and-email]

Post your form to a route in your application.

```html
<form action="/api/register" method="post">
  <label for="name">Name</label>
  <input id="name" name="name" required />
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required />
  <button type="submit">Register</button>
</form>
```

## 2. Issue the ticket [#2-issue-the-ticket]

In your server handler, validate the form and use your event’s ID.
The SDK reads your server’s EVENTLAYER\_KEY.

```ts title="Registration handler · server"
import { Eventlayer } from "eventlayer";

const eventlayer = new Eventlayer();
const form = await request.formData();

const { data: attendee, error: attendeeError } = await eventlayer.attendees.create({
  eventId: "ev_your_event",
  name: String(form.get("name")),
  email: String(form.get("email")),
  createTicket: true,
});
if (attendeeError) throw attendeeError;
```

Save `attendee.id` and `attendee.ticket.id` with your registration, then show your
confirmation page. Your application handles capacity and registration rules.

For paid events, [confirm payment before issuing the ticket](/docs/guides/payments).
The attendee and ticket are created together. If either fails, neither is saved.
For duplicate submissions and lost responses, see [retries and recovery](/docs/retries).

## Next steps [#next-steps]

[Add a Wallet pass](/docs/guides/apple-wallet) or
[send a confirmation email](/docs/guides/email).
