| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/vendorset/Vendorapp/backup files/ |
Upload File : |
<?php
// Enable error reporting for debugging
ini_set('display_errors', 1);
error_reporting(E_ALL);
// If the form is submitted, process the registration and redirect to the Square payment page
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Capture form data and assign default values if any field is missing
$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$phone = isset($_POST['phone']) ? $_POST['phone'] : '';
$address = isset($_POST['address']) ? $_POST['address'] : '';
$city = isset($_POST['city']) ? $_POST['city'] : '';
$state = isset($_POST['state']) ? $_POST['state'] : '';
$zip = isset($_POST['zip']) ? $_POST['zip'] : '';
$website = isset($_POST['website']) ? $_POST['website'] : '';
$description = isset($_POST['description']) ? $_POST['description'] : '';
$category = isset($_POST['category']) ? $_POST['category'] : '';
$spots = isset($_POST['spots']) ? $_POST['spots'] : 1; // Default to 1 spot if missing
// Set the payment amount based on spots selected (example logic for pricing)
$amount = $spots * 50; // Assume each spot costs $50
// Generate a unique transaction ID
$transaction_id = uniqid('vendor_', true);
// Debugging: Output form data and variables
echo "<pre>";
echo "Form Data:\n";
var_dump($_POST);
echo "Transaction ID: " . $transaction_id . "\n";
echo "Amount: " . $amount . "\n";
echo "</pre>";
// Save vendor data in the database
include 'config.php'; // Your DB configuration
// Establish a database connection
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Prepare the SQL query with error handling
$sql = "INSERT INTO vendors (name, email, phone, address, city, state, zip, website, description, category, spots, amount, payment_status, transaction_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unpaid', ?)";
if ($stmt = $conn->prepare($sql)) {
// Bind parameters to the prepared statement
$stmt->bind_param(
"ssssssssssds", // Type definition string (13 placeholders)
$name, $email, $phone, $address, $city, $state, $zip,
$website, $description, $category, $spots, $amount, $transaction_id
);
// Execute the query and check for success
if ($stmt->execute()) {
// Redirect to the Square payment page
$payment_url = "https://square.link/u/umcczuk0?src=embd&amount=" . urlencode($amount) . "&transaction_id=" . urlencode($transaction_id);
header("Location: " . $payment_url);
exit();
} else {
// If execution fails, output the error
echo "Error executing SQL query: " . $stmt->error;
}
// Close the statement
$stmt->close();
} else {
// If prepare fails, output the error
echo "Error preparing SQL query: " . $conn->error;
}
// Close the database connection
$conn->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vendor Registration</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #F5F5F5;
color: #333333;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 20px;
}
.logo {
width: 150px;
margin-bottom: 20px;
}
.main-container {
background-color: #FFFFFF;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 600px;
}
h2 {
color: #1E90FF;
text-align: center;
}
form {
display: flex;
flex-direction: column;
text-align: left;
}
label {
margin-top: 10px;
font-weight: bold;
}
input, textarea, select {
padding: 10px;
margin-top: 5px;
border: 1px solid #CCCCCC;
border-radius: 4px;
font-size: 16px;
}
input:focus, textarea:focus, select:focus {
border-color: #1E90FF;
outline: none;
}
button {
background-color: #1E90FF;
color: #FFFFFF;
padding: 10px;
margin-top: 20px;
border: none;
border-radius: 4px;
font-size: 18px;
cursor: pointer;
}
button:hover {
background-color: #1C86EE;
}
.agreement {
margin-top: 20px;
font-size: 14px;
}
.agreement a {
color: #1E90FF;
text-decoration: none;
}
.agreement a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<!-- Logo centered at the top -->
<img src="https://www.thelittlebigshow.com/wp-content/uploads/2024/02/cropped-Logo.jpg" alt="Event Logo" class="logo">
<div class="main-container">
<h2>Vendor Registration Form</h2>
<form action="index.php" method="POST">
<label for="name">Full Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email Address:</label>
<input type="email" id="email" name="email" required>
<label for="phone">Phone Number:</label>
<input type="tel" id="phone" name="phone" required>
<label for="address">Address:</label>
<input type="text" id="address" name="address" placeholder="Street Address" required>
<label for="city">City:</label>
<input type="text" id="city" name="city" required>
<label for="state">State:</label>
<input type="text" id="state" name="state" required>
<label for="zip">Zip Code:</label>
<input type="text" id="zip" name="zip" required>
<label for="website">Website (if any):</label>
<input type="text" id="website" name="website" placeholder="Enter your website URL">
<label for="description">Description of What You Sell:</label>
<textarea id="description" name="description" rows="4" placeholder="Describe your products or services" required></textarea>
<label for="category">Select the Closest Option of What You Sell:</label>
<select id="category" name="category" required>
<option value="" disabled selected>Select an option</option>
<option value="Food & Beverages">Food & Beverages</option>
<option value="Handmade Crafts">Handmade Crafts</option>
<option value="Candles">Candles</option>
<option value="Clothing & Apparel">Clothing & Apparel</option>
<option value="Art & Prints">Art & Prints</option>
<option value="Electronics">Electronics</option>
<option value="Jewelry">Jewelry</option>
<option value="Books & Literature">Books & Literature</option>
<option value="Toys & Games">Toys & Games</option>
<option value="Furniture">Furniture</option>
<option value="Beauty & Personal Care">Beauty & Personal Care</option>
<option value="Sports Equipment">Sports Equipment</option>
<option value="Home Goods & Decor">Home Goods & Decor</option>
<option value="Pet Supplies">Pet Supplies</option>
<option value="Other">Other</option>
</select>
<!-- Number of Spots Dropdown -->
<label for="spots">Number of Spots:</label>
<select id="spots" name="spots" required>
<option value="" disabled selected>Select the number of spots</option>
<option value="1">1 Spot</option>
<option value="2">2 Spots</option>
<option value="3">3 Spots</option>
</select>
<div class="agreement">
By registering, you agree to our <a href="hold_harmless_agreement.html" target="_blank">Hold Harmless Agreement</a>.
</div>
<button type="submit">Register</button>
</form>
</div>
</body>
</html>