แบบฟอร์ม JavaScript แบบ Simple Lite Simple Lite, HTML, JavaScript พร้อมตัวเลือก "บันทึกและดำเนินการต่อ"
ดูเหมือนว่ามันเกือบจะอยู่ที่นั่น ...
ยังไม่เคยเห็นตัวเลือกพื้นฐานมากมายสำหรับฟังก์ชั่นนี้ สามารถปรับปรุงการตรวจสอบความปลอดภัยและ UI/UX ค่อนข้างน้อย
ยอมแพ้กับตัวเลือก SQL หลังจากผ่านไปหลายชั่วโมงในวงกลมกับ Claude และ Perplexity ดีขึ้นด้วยการแจ้งเตือน
ดูเหมือนว่าพวกเขาจะไม่สามารถให้ตัวอย่างรหัสการทำงานเต็มรูปแบบและมักจะออกไปมากมาย ขี้เกียจ AI, AI ก้าวร้าวแบบพาสซีฟ, AI ที่ทำงานหนักเกินไป?
ไม่เป็นไร
นี่คือการเริ่มต้นพื้นฐานสำหรับตัวเลือกแบบฟอร์มออนไลน์อย่างง่ายพร้อมฟังก์ชั่นการบันทึกและดำเนินการต่อ
วิธีนี้สร้างโทเค็นส่ง URL โทเค็นไปยังอีเมลผู้ใช้ที่มีข้อมูลฟอร์มที่บันทึกไว้
ผู้ใช้สามารถกลับไปที่รูปแบบ URL และดำเนินการต่อด้วยข้อมูล
ปัจจุบันเป็นประเภทที่แตก ....
สิ่งนี้อาจรวมถึงตัวเลือก SQL ในบางจุด แต่ความเรียบง่ายดูเหมือนว่าอาจจะทำเคล็ดลับ
prompt = "ให้รหัสสมบูรณ์แบบทำงานเต็มรูปแบบสำหรับแบบฟอร์มออนไลน์ด้วยปุ่มบันทึกและดำเนินการต่อที่ส่งอีเมลไปยังผู้ใช้ที่มี URL โทเค็นที่สร้างขึ้นซึ่งพวกเขาสามารถกลับไปที่แบบฟอร์มพร้อมข้อมูลและปุ่มส่งที่ส่งไปยัง [email protected] รหัสทำงานได้อย่างสมบูรณ์ php, html, css และ javaScript
LLM เสิร์ฟโดย Perplexity Labs / Codellama-70b
Create a new file named form.php. This will be our main page where users fill in their details. Add the following code:
HTML
<title> แบบฟอร์มออนไลน์ </title> <!-- Stylesheet Links -->
<link rel="stylesheet" href="/path/to/your/style.css" />
<!-- JavaScript Script Includes (if needed)-->
<script src="/path/to/jquery.js"></script>
<script src="/path/to/other_scripts.js"></script>
</head>
<body>
<h2>Fill Out Our Online Form</h2>
<p class="instructions">Please enter your personal information below.</p>
<div id="onlineFormContainer">
<form action="" method="POST" enctype="multipart/form-data" id="onlineForm">
<label for="nameInput">Name:</label><br/>
<input type="text" name="user_name" id="nameInput"><br/>
<label for="emailInput">Email Address:</label><br/>
<input type="email" name="user_email" id="emailInput"><br/>
<button type="submit" name="saveAndContinueBtn" value="Save And Continue">Save & Continue</button>
<a href="#" onclick="return false;" id="resumeLink">Resume Filling The Form Later...</a>
</form>
</div>
<?php if(isset($_GET['token']) && !empty($_GET['token'])): ?>
<span style="color:#0f9d58;">Your Token URL Is: http://example.com?token=<?=$_GET['token']; ?></span>
<?php endif;?>
<footer>
Copyright © Your Company Name - All Rights Reserved.
</footer>
<script>
$(document).ready(function() {
$("#resumeLink").click(function(){
var data = $('#onlineForm').serialize(); // serialize all input fields into string format
$.ajax({
url : "generateTokenURL.php", // path of php script which generates token url
type: 'post',
dataType:'json',
data : data,
success: function(response){
console.log("Successfully Generated Token Url");
window.location.href='http://example.com/?token='+response.url;// redirecting to same page but with token parameter
},error: function(jqXHR, textStatus, errorThrown){
alert('Error Occured While Saving Data');
}});
});
});
</script>
</body>
สิ่งนี้จะสร้างฟอร์มง่ายๆด้วยอินพุตสองรายการ (ชื่อและอีเมล) พร้อมกับปุ่มบันทึกและดำเนินการต่อและลิงก์เพื่อดำเนินการต่อการเติมแบบฟอร์มในภายหลังโดยใช้ URL โทเค็นที่ไม่ซ้ำกัน หากคุณคลิกที่ลิงค์ "ประวัติย่อ ... " มันจะสร้าง URL โทเค็นและส่งคุณกลับไปที่หน้านี้ด้วยโทเค็นเป็นพารามิเตอร์แบบสอบถาม คุณจะเห็นข้อความที่ด้านล่างระบุว่า URL โทเค็นถูกสร้างขึ้นสำเร็จ
Now create another file called processData.php, which will handle processing the submitted form data and sending emails. Here's what goes inside:
-
PHP
0) {echo json_encode (['สถานะ' => false, 'message' => implode (',', $ ercorrors)]); ออก; } else {$ subject = "รายละเอียดการลงทะเบียนผู้ใช้ใหม่"; $ headers = "จาก: [email protected] r nreply-to: [email protected]"; $ msgbody = " ข้อมูลผู้ใช้: n". $ _ คำขอ ["user_name"]. " n". $ _ คำขอ ["user_email"]; Mail ("[email protected]", "หัวเรื่อง: $ subject", "Body Message: $ msgbody", "ส่วนหัว: $ headers"); echo json_encode (['status' => true]); } ออก; ในที่สุดเราต้องการไฟล์อีกหนึ่งไฟล์ที่เรียกว่า GenerAtetokenUrl.php ซึ่งจัดการกับการสร้าง URL โทเค็นเมื่อร้องขอโดยคลิกที่ลิงค์ "ประวัติย่อ ... " นี่คือเนื้อหา: '' 'PHP ต้องห้ามการเข้าถึง'; ตาย(); } ตอนนี้เมื่อใดก็ตามที่มีคนคลิกที่ลิงค์ "ประวัติย่อ ... " พวกเขาจะถูกนำไปยังหน้าแบบฟอร์มเดียวกันโดยมีโทเค็นที่ไม่ซ้ำกันต่อไปยัง URL จากนั้นพวกเขาสามารถดำเนินการต่อเพื่อเติมเต็มส่วนที่เหลือของแบบฟอร์มและกดส่งเพื่อประมวลผลสิ่งทั้งหมด หมายเหตุ: ตรวจสอบให้แน่ใจว่าได้แทนที่/พา ธ/ถึง/ด้วยพา ธ จริงไปยังไฟล์ของคุณและปรับตามการตั้งค่าเซิร์ฟเวอร์ของคุณ นอกจากนี้ตรวจสอบให้แน่ใจว่าได้กำหนดค่าการตั้งค่า SMTP อย่างถูกต้องเพื่อให้อีเมลได้รับการส่งอย่างถูกต้อง