Reformat functions

This commit is contained in:
edsea
2025-10-12 00:07:59 +02:00
parent 414b6c5a3a
commit 0f160833f3
10 changed files with 77 additions and 56 deletions

View File

@@ -24,6 +24,7 @@ $user_id = $_SESSION['user_id'] ?? null;
'formal' => 'Write this email in a formal tone',
'casual' => 'Write this email in a casual tone',
'persuasive' => 'Write this email in a persuasive tone',
'angry' => 'Write this email in a angry but yet formal tone',
];
if (empty($emailInput) || !isset($allowedTones[$tone])) {
@@ -73,14 +74,11 @@ $user_id = $_SESSION['user_id'] ?? null;
echo "<button id='copyBtn'>Copy Email</button>";
echo "<button id='saveBtn'>Save Email as .txt</button>";
echo "<a href='/home.php'><button>🏠 Back to Home</button></a>";
echo "<a href='/inc/php/generate.php' class='back-link'>← Generate Another Email</a>";
// NEW: Save to DB form
if ($user_id) {
echo "<form method='POST' action='/inc/php/save_email.php' style='margin-top:15px;'>";
echo "<input type='hidden' name='email_body' value=\"" . htmlspecialchars($aiEmail, ENT_QUOTES) . "\">";
echo "<input type='text' name='subject' placeholder='Subject (optional)'>";
echo "<button type='submit'>💾 Save to My Account</button>";
echo "</form>";
}