Existing GTM Profiles
+ +| Business Name | +Sells What | +Created At | +Action | +
|---|---|---|---|
| + | + | + | View | +
diff --git a/assets/js/main.js b/assets/js/main.js index 8ff3ac2..260453c 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,64 +1,71 @@ document.addEventListener('DOMContentLoaded', function() { - const steps = document.querySelectorAll('.form-step'); - const nextButtons = document.querySelectorAll('.btn-next'); - const prevButtons = document.querySelectorAll('.btn-prev'); - const progressBar = document.querySelector('.progress-bar'); const form = document.getElementById('gtm-form'); - let currentStep = 0; + if (form) { + const steps = document.querySelectorAll('.form-step'); + const nextButtons = document.querySelectorAll('.btn-next'); + const prevButtons = document.querySelectorAll('.btn-prev'); + const progressBar = document.querySelector('.progress-bar'); - function updateProgress() { - const progress = ((currentStep + 1) / steps.length) * 100; - progressBar.style.width = progress + '%'; - progressBar.setAttribute('aria-valuenow', progress); + let currentStep = 0; + + function updateProgress() { + if (progressBar) { + const progress = ((currentStep + 1) / steps.length) * 100; + progressBar.style.width = progress + '%'; + progressBar.setAttribute('aria-valuenow', progress); + } + } + + function showStep(stepIndex) { + steps.forEach((step, index) => { + step.classList.toggle('active', index === stepIndex); + }); + currentStep = stepIndex; + updateProgress(); + } + + nextButtons.forEach(button => { + button.addEventListener('click', () => { + if (currentStep < steps.length - 1) { + showStep(currentStep + 1); + } + }); + }); + + prevButtons.forEach(button => { + button.addEventListener('click', () => { + if (currentStep > 0) { + showStep(currentStep - 1); + } + }); + }); + + form.addEventListener('submit', function(e) { + e.preventDefault(); + const formData = new FormData(form); + + fetch('submit_profile.php', { + method: 'POST', + body: formData + }) + .then(response => response.json()) + .then(data => { + if (data.success) { + window.location.href = 'profile.php?id=' + data.profile_id; + } else { + alert('An error occurred: ' + data.error); + } + }) + .catch(error => { + console.error('Error:', error); + alert('A network error occurred. Please try again.'); + }); + }); + + if(steps.length > 0) { + showStep(0); + } } - - function showStep(stepIndex) { - steps.forEach((step, index) => { - step.classList.toggle('active', index === stepIndex); - }); - currentStep = stepIndex; - updateProgress(); - } - - nextButtons.forEach(button => { - button.addEventListener('click', () => { - if (currentStep < steps.length - 1) { - showStep(currentStep + 1); - } - }); - }); - - prevButtons.forEach(button => { - button.addEventListener('click', () => { - if (currentStep > 0) { - showStep(currentStep - 1); - } - }); - }); - - form.addEventListener('submit', function(e) { - e.preventDefault(); - const formData = new FormData(form); - - fetch('submit_profile.php', { - method: 'POST', - body: formData - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - document.getElementById('form-container').innerHTML = '
AI Powered Solutions Generating Profitable and Efficient Revenue and Customer Growth
Build New Process and Organization - Existing Process - Existing Organization + Existing Process + Existing Organization diff --git a/list_profiles.php b/list_profiles.php new file mode 100644 index 0000000..e885e15 --- /dev/null +++ b/list_profiles.php @@ -0,0 +1,86 @@ +query("SELECT id, business_name, sells_what, created_at FROM gtm_profiles ORDER BY created_at DESC"); + $profiles = $stmt->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + // Handle database connection error + error_log($e->getMessage()); +} + +?> + + + + + +| Business Name | +Sells What | +Created At | +Action | +
|---|---|---|---|
| + | + | + | View | +
What we sell:
+Sells What:
Ideal Customer Profile (ICP):
@@ -84,7 +88,7 @@ try {