Skip to content

Instantly share code, notes, and snippets.

@matherton
Created September 23, 2011 10:20
Show Gist options
  • Save matherton/1237087 to your computer and use it in GitHub Desktop.
Save matherton/1237087 to your computer and use it in GitHub Desktop.
Simple Eventbrite create venue and event form
<?php
/* This script does:
1. Get the variables from the event_form.php
2. Put the variables into a string which also contains our app_key and user_key
3. Pass the url string to the Event brite API to create new events
4. Recieve a ticket from event brite API for the newly created event
*/
// Get the method from the form
$method = $_POST['method_type'];
// Get the mandatiory values for creating new venue
// now hard coded: $organizer_id = $POST['organiser_id'];
$venue = $_POST['venue'];
$region = $_POST['region'];
// Get the non mandatory values from the form
$adress = $_POST['adress'];
$adress_2 = $_POST['adress_2'];
$city = $_POST['city'];
$postal_code = $_POST['postal_code'];
// Get mandatory values from form for creating new event
$title = $_POST['title'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$timezone = $_POST['timezone'];
// Get values non mandatory values from form for creating new event
$description = $_POST['description'];
$event_type = $_POST['event_type'];
?>
<html>
<head>
</head>
<body>
<h1>Create new venue</h1>
<ul>
<li><a href="http://www.eventbrite.com/json/venue_new?app_key='YOUR APP KEY HERE'&user_key='YOUR USER KEY HERE'&organizer_id=1487912990&venue=<?php echo $venue; ?>&region=<?php echo $region; ?>&country_code=GB&adress=<?php echo $adress; ?>&adress_2=<?php echo $adress_2; ?>&city=<?php echo $city; ?>&postal_code=<?php echo $postal_code; ?>">Create Venue</a></li>
<li><a href="event_form.php">Go back to form</a></li>
<ul>
<h2>Create new event</h2>
<ul>
<li><a href="http://www.eventbrite.com/json/event_new?app_key='YOUR APP KEY HERE'&user_key='YOUR USER KEY HERE'&title=<?php echo $title; ?>&description=<?php echo $description; ?>&venue_address=<?php echo $venue_address; ?>&event_type=<?php echo $event_type; ?>&start_date=<?php echo $start_date; ?>&end_date=<?php echo $end_date; ?>&timezone=GMT+01">Create Event</a></li>
<li><a href="event_form.php">Go back to form</a></li>
<ul>
</body>
</html>
<html>
<head>
<title>Event creation form</title>
</head>
<!-- All strings - These are mandatory fields title, start_date, end_date, timezone. The description is optional but guess we would require -->
<body>
<!-- A form to create an event and passes it's variables to event_creator.php -->
<form method="post" action="event_creator.php">
<fieldset>
<legend>Select update type</legend>
<select name="method_type">
<option value="">please select</option>
<option value="venue_new">venue address update</option>
<option value="event_new">create new event</option>
</select>
</fieldset>
<fieldset>
<legend>Enter venue details <strong>(mandatory)</strong></legend>
<p><label for venue>Enter venue name: </label><input name="venue" id="venue" type="text">
<label for region>Enter venue region: </label><input name="region" id="region" type="text" placeholder="enter the venue county"></p>
</fieldset>
<fieldset>
<legend>Enter venue details (optional)</legend>
<p><label for adress>Enter venue address line 1: </label><input name="adress" id="adress" type="text">
<label for adress_2>Enter venue address line 2: </label><input name="adress_2" id="adress_2" type="text"></p>
<p><label for city>Enter venue city: </label><input name="city" id="city" type="text">
<label for adress>Enter venue post code: </label><input name="postal_code" id="postal_code" type="text"></p>
</fieldset>
<fieldset>
<legend>Enter event details <strong>(mandatory)</strong></legend>
<p><label for title>Enter event title: </label><input name="title" id="title" type="text" placeholder="255 characters max">
<label for start_date>Enter start date+time: </label><input name="start_date" id="start_date" type="text" placeholder="2011-12-31+10:00:00"></p>
<p><label for end_date>Enter end date+time: </label><input name="end_date" id="end_date" type="text" placeholder="2012-01-01+02:00:00"></p>
</fieldset>
<fieldset>
<legend>Select event type (optional)</legend>
<select name="event_type">
<option value="">please select the category</option>
<option value="film">film</option>
<option value="theatre">theatre</option>
<option value="rock">rock</option>
<option value="pop">pop</option>
<option value="dance">dance</option>
<option value="classical">classical</option>
<option value="comedy">comedy</option>
</select>
<br />
<br />
<label for description>Description:</label><textarea name="description" id="description" rows="5" placeholder="Please enter a description of your event"></textarea>
<br />
<br />
<input type="submit" name="submit" value="submit form">
</legend>
</fieldset>
</form>
</body>
</html>
@matherton
Copy link
Author

This is my first script that adds test data into the Eventbrite API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment