function closePage() {
const confirmClose = confirm('Want to close this page?');
if (confirmClose) {
const allButtonData = getAllButtonsData();
saveAllButtonsData(allButtonData);
window.close();
}
}
function getAllButtonsData() {
const allButtonData = [];
<!DOCTYPE html>
Edit Button Information
Js:
let buttonCount = 0; const xhr = new XMLHttpRequest(); let currentButton; const createdButtons = [];
function createButton(shape) { const newButton = document.createElement('button'); newButton.className = 'button'; newButton.innerHTML =
Button ${++buttonCount}
;}
function openModal() { const modal = document.getElementById('infoModal'); modal.style.display = 'block'; }
function closeModal() { const modal = document.getElementById('infoModal'); modal.style.display = 'none'; }
function displayButtonInfo() { const url = 'getButtonInfo.php'; const data = JSON.stringify({ buttonName: currentButton.innerHTML, });
}
function saveUpdatedInfo() { const updateInfoInput = document.getElementById('updateInfo'); const updatedInfo = updateInfoInput.value;
}
function closePage() { const confirmClose = confirm('Want to close this page?'); if (confirmClose) { const allButtonData = getAllButtonsData(); saveAllButtonsData(allButtonData); window.close(); } }
function getAllButtonsData() { const allButtonData = [];
}
function saveAllButtonsData(allButtonData) { const url = 'saveAllButtonsData.php'; const data = JSON.stringify(allButtonData);
}
function getButtonShape(button) { return button.style.borderRadius === '50%' ? 'circle' : 'rectangle'; }
function ajaxRequest(method, url, data, callback) { xhr.open(method, url, true); xhr.setRequestHeader('Content-type', 'application/json');
}
getButtonInfo.php
<?php $data = json_decode(file_get_contents('php://input'), true);
$servername = "your_server_name"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";
try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); }
$conn = null; ?>
UpdatButtonInfo:
<?php $data = json_decode(file_get_contents('php://input'), true);
$servername = "your_server_name"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";
try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); }
$conn = null; ?>
SaveAllButtonsData:
<?php $data = json_decode(file_get_contents('php://input'), true);
$servername = "your_server_name"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";
try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); }
$conn = null; ?>