เราจะสร้างฟอร์ม เพื่อเอาค่าที่กรอกมาแทน ค่าในอะเรย์ได้อย่างไรคะ
หนูสร้าง ไฟล์ที่ 1. สร้างฟอร์ม เพื่อใส่คำลงไปเป็นคำอะไรก็ได้
สร้ง ไฟล์ที่ 2. นำค่าที่ได้นั้นมาแทนที่ใน $replace[] = ค่าที่รับมาจากฟอร์ม
เช่น <input name="title" type="text" /> เมื่อกรอกคำว่า Hello world ลงไปไฟล์ที่ 1 กด submit
แล้วให้คำว่า Hello world แทนค่าลงไปเป็นแบบนี้เลย $replace[] = 'Hello world'; อัตโนมัติเลย ต้องเขีนโค้ดอย่างไรค่ะ
สอบถามเรื่องการสร้างฟอร์ม แล้วเอาค่าไปแทนที่ในอะเรย์ โดยอัตโนมัติ หน่อยค่ะ
Moderators: mindphp, ผู้ดูแลกระดาน
- tsukasaz
- PHP VIP Members
- Posts: 13105
- Joined: 18/04/2012 9:39 am
Re: สอบถามเรื่องการสร้างฟอร์ม แล้วเอาค่าไปแทนที่ในอะเรย์ โดยอัตโนมัติ หน่อยค่ะ
สร้างฟอร์มปกติธรรมดา
2.php
Code: Select all
<form name="frm" method="post" action="2.php">
<input name="title" type="text" />
<input type="submit" value="submit" />
</form>
Code: Select all
<?php
$replace[] = $_POST['title'];
?>
The last bug isn't fixed until the last user is dead. (Sidney Markowitz, 1995)
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Tip CSS : Aytomatic Image slideshow (สไลด์โชว์ภาพอย่างง่าย) โดยอัตโนมัติ
by pprn » 12/07/2018 2:34 pm » in CSS Knowledge - 0 Replies
- 2966 Views
-
Last post by pprn
12/07/2018 2:34 pm
-
-
-
ช่วยแก้โจทย์ C# หน่อยค่ะ 1 ข้อ
by Nongfern » 04/08/2012 1:13 pm » in Programming - C/C++ & java & Python - 3 Replies
- 2058 Views
-
Last post by tohkai_php
07/08/2012 4:13 pm
-
-
- 3 Replies
- 3291 Views
-
Last post by sarunyoo
24/12/2012 12:18 am
-
- 3 Replies
- 492 Views
-
Last post by offing
09/03/2015 10:31 am
-
-
ขอวิธีอัพเดท PHP 5.5.9 เป็น PHP 7 หน่อยค่ะ
by thatsawan » 20/11/2020 12:09 pm » in Programming - PHP - 1 Replies
- 197 Views
-
Last post by mindphp
20/11/2020 12:54 pm
-
-
- 1 Replies
- 276 Views
-
Last post by thatsawan
29/03/2017 12:52 am
Who is online
Users browsing this forum: No registered users and 12 guests