ขอตัวอย่างการเขียนโค้ด php การบันทึกข้อมูล

wave
deelertSR
3,973
สังคมนักพัฒนาระบบ (Community)
ขอตัวอย่างการเขียนโค้ด php การบันทึกข้อมูล

ขอตัวอย่างการเขียนโค้ด php การบันทึกข้อมูลด้วย form ที่เป็นทั้งแบบ input type="radio" กับ input type="text"  ลงฐานข้อมูลหน่อยครับ

ลองทำดูแล้ว แต่ข้อมูลไม่ยอมลงฐาน ต้องขอคำแนะจากผู้รู้หน่อยครับ

1 ความคิดเห็น

  • santakoe

form.php

<form name="form1" method="post" action="insform.php">

<input type="radio" name="rad" value="1"> statement1  

<input type="radio" name="rad" value="2"> statement2 

<input name="other" type="text">

<input type="submit" name="submit" value="SAVE">

</form>

=====================

insform.php

$rad = $_POST["rad"]);

$other = $_POST["other"]);

INSERT INTO table_name (rad_field, other_field) VALUES ('$rad', '$other');

=====================

ลองดูตามนี้นะ