Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > ต้องการโชว์ข้อมูลที่กรอกลงไปบนหน้าเว็บนึง เพื่อไปโชว์อีกหน้าเว็บนึง mysql php


[PHP] ต้องการโชว์ข้อมูลที่กรอกลงไปบนหน้าเว็บนึง เพื่อไปโชว์อีกหน้าเว็บนึง mysql php

 
Topic : 117173



โพสกระทู้ ( 6 )
บทความ ( 0 )



สถานะออฟไลน์



การกรอกข้อมูลเพื่อโชว์ขึ้นอีกหน้าเว็บ

คือต้องการให้ข้อมูลที่กรอกลงไปมาใชว์อีกหน้าเว็บนึงอ่ะคะ


Code (PHP)
001.<?php require_once('Connections/conn.php'); ?>
002.<?php
003.if (!function_exists("GetSQLValueString")) {
004.function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
005.{
006.  if (PHP_VERSION < 6) {
007.    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
008.  }
009. 
010.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
011. 
012.  switch ($theType) {
013.    case "text":
014.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
015.      break;   
016.    case "long":
017.    case "int":
018.      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
019.      break;
020.    case "double":
021.      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
022.      break;
023.    case "date":
024.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
025.      break;
026.    case "defined":
027.      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
028.      break;
029.  }
030.  return $theValue;
031.}
032.}
033. 
034.$editFormAction = $_SERVER['PHP_SELF'];
035.if (isset($_SERVER['QUERY_STRING'])) {
036.  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
037.}
038. 
039.if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
040.  $insertSQL = sprintf("INSERT INTO tb_accept_human (student_id, name, lastname, code, list, version, accept, accept_other, food_other, address, officer, phone, email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
041.                       GetSQLValueString($_POST['student_id'], "text"),
042.                       GetSQLValueString($_POST['name'], "text"),
043.                       GetSQLValueString($_POST['lastname'], "text"),
044.                       GetSQLValueString($_POST['code'], "text"),
045.                       GetSQLValueString($_POST['list'], "text"),
046.                       GetSQLValueString($_POST['version'], "text"),
047.                       GetSQLValueString(isset($_POST['accept']) ? "true" : "", "defined","'Y'","'N'"),
048.                       GetSQLValueString($_POST['accept_other'], "text"),
049.                       GetSQLValueString($_POST['food_other'], "text"),
050.                       GetSQLValueString($_POST['address'], "text"),
051.                       GetSQLValueString($_POST['officer'], "text"),
052.                       GetSQLValueString($_POST['phone'], "text"),
053.                       GetSQLValueString($_POST['email'], "text"));
054. 
055.  mysql_select_db($database_conn, $conn);
056.  $Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());
057. 
058.  $insertGoTo = "check_accept_human.php";
059.  if (isset($_SERVER['QUERY_STRING'])) {
060.    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
061.    $insertGoTo .= $_SERVER['QUERY_STRING'];
062.  }
063.  header(sprintf("Location: %s", $insertGoTo));
064.}
065.?>
066.<!doctype html>
067.<html>
068.<head>
069.<meta charset="utf-8">
070.<title>แบบกรอกรายละเอียด</title>
071.</head>
072. 
073.<body>
074.<table width="814" border="0" align="center" cellpadding="0" cellspacing="0">
075.  <tr>
076.    <th width="1819" bgcolor="#CCCCCC" scope="col">แบบตอบรับ</th>
077.  </tr>
078.  <tr>
079.    <td bgcolor="#CCCCCC"><table width="522" border=0" align="center">
080.      <tr bgcolor="#999999">
081.        <th align="center" valign="middle" scope="col" colortxt="red">คำชี้แจง : ขอให้นักศึกษาโปรดกรอกรายละเอียดให้ครบถ้วน</th>
082.      </tr>
083.    </table></td>
084.  </tr>
085.  <tr align="left">
086.    <td><form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
087.      <p>1. ตอบรับการเข้าฝึกปฏิบัติเสริมทักษะ รหัสวิชา :
088.        <label for="code"></label>
089.        <input type="text" name="code" id="code">
090.        &nbsp;ชุดวิชา :
091.        <label for="list"></label>
092.        <input type="text" name="list" id="list">
093.      </p>
094.      <p>2. เลขประจำตัวนักศึกษา :
095.        <label for="phone"></label>
096.        <input type="text" name="student_id" id="textfield4">
097.        ชื่อ :
098.        <label for="lastname"></label>
099.        <input type="text" name="name" id="textfield2">
100.      &nbsp;&nbsp;นามสกุล
101.      :
102.      <label for="student_id"></label>
103.      <input type="text" name="lastname" id="textfield3">
104.      &nbsp;รุ่นที่
105.      <label for="version"></label>
106.      :
107.      <input name="version" type="text" id="version" size="7">
108.      3. สามารถเข้ารับการฝึกปฏิบัติเสริมทักษะ
109.  <input name="accept" type="checkbox" id="accept">
110.        <label for="accept"></label>
111.        ได้
112.        <input type="checkbox" name="decline" id="decline">
113.        <label for="decline"></label>
114.        &nbsp;ไม่ได้ &nbsp;&nbsp;โปรดระบุเหตุผล &nbsp;&nbsp;&nbsp;
115.        <textarea name="accept_other" id="accept_other"></textarea>
116.      </p>
117.      <p>
118.        <label for="accept_other"></label>
119.        4
120.        . อาหารที่รับประทาน :
121.        <input type="radio" name="food_general" id="radio" value="food_general">
122.        <label for="food_general"></label>
123.&nbsp;ทั่วไป&nbsp;
124.<input type="radio" name="food_halal" id="radio2" value="radio2">
125.<label for="food_halal"></label>
126.&nbsp;อิสลาม&nbsp;
127.<input type="radio" name="food_veget" id="radio3" value="radio3">
128.<label for="food_veget"></label>
129.&nbsp;มังสวิรัติ&nbsp;
130.<input type="radio" name="food_j" id="radio4" value="radio4">
131.<label for="food_j"></label>
132.&nbsp;เจ&nbsp;
133.<input type="radio" name="other" id="radio5" value="radio5">
134.<label for="other"></label>
135.&nbsp;อื่นๆ (โปรดระบุ)&nbsp;
136.<label for="food_other"></label>
137.<textarea name="food_other" cols="100" id="food_other"></textarea>
138.  </p>
139.      <p>6. ที่อยู่
140.        :
141.        <label for="address"></label>
142.        <textarea name="address" cols="50" rows="2" id="address"></textarea>
143.       &nbsp;&nbsp;&nbsp;7. สถานที่ทำงาน&nbsp; :
144.       <label for="officer"></label>
145.       <textarea name="officer" id="officer"></textarea>
146.    </p>
147.      <p>8. โทรศัพท์ (ที่ติดต่อได้สะดวก)&nbsp;:
148.        <label for="textfield5"></label>
149.        <input type="text" name="phone" id="textfield5">
150.      &nbsp;&nbsp;9. E-mail :
151.      <label for="email"></label>
152.      <input name="email" type="text" id="email" size="50">
153.      </p>
154.      <p>
155.        <center><input type="submit" name="confirm" id="confirm" value="ส่งข้อมูล"></center>
156.      </p>
157.      <input type="hidden" name="MM_insert" value="form1">
158.    </form></td>
159.  </tr>
160.  <tr>
161.    <td>&nbsp;</td>
162.  </tr>
163.  <tr>
164.    <td>&nbsp;</td>
165.  </tr>
166.</table>
167.</body>
168.</html>




Tag : PHP, MySQL

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-06-15 15:54:03 By : emopink009 View : 3382 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ถ้าเว็บเดียวกันก็ Insert แลเงดึงมาว์ได้เลยครับ

PHP MySQL Add/Insert Record

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-15 17:11:53 By : mr.win
 

 

No. 2



โพสกระทู้ ( 6 )
บทความ ( 0 )



สถานะออฟไลน์


ผิดพลาดตรงไหนหรอค่ะ ทำไมไม่โชว์ข้อมูล รบกวนด้วยคะ

พอกดปุ่มเพื่อโชว์ข้อมูล

Code (PHP)
01.<html>
02.<head>
03.<title>เช็ดรายละเอียด</title>
04.</head>
05.<body>
06.<?php
07.$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
08.$objDB = mysql_select_db("db_stou");
09.$strSQL = "INSERT INTO tb_accept_human";
10.$strSQL .="(code,list,student_id,name,lastname,version,accept,accept_other,food,other,food_other,address,officer,phone,email) ";
11.$strSQL .="VALUES ";
12.$strSQL .="('".$_POST["code"]."','".$_POST["list"]."','".$_POST["student_id"]."' ";
13.$strSQL .=",'".$_POST["name"]."','".$_POST["lastname"]."','".$_POST["version"]."') ";
14.$strSQL .="('".$_POST["accept"]."','".$_POST["accept_other"]."','".$_POST["food"]."' ";
15.$strSQL .="('".$_POST["food_other"]."','".$_POST["address"]."','".$_POST["officer"]."' ";
16.$strSQL .=",'".$_POST["phone"]."','".$_POST["email"]."') ";
17.$objQuery = mysql_query($strSQL);
18.if($objQuery)
19.{
20.echo "Save Done.";
21.}
22.else
23.{
24.echo "Error Save [".$strSQL."]";
25.}
26.mysql_close($objConnect);
27.?>
28.</body>
29.</html>
30.<?php
31.mysql_query("SET character_set_results=utf8");
32.mysql_query("SET character_set_client=utf8");
33.mysql_query("SET character_set_connection=utf8");
34.?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-16 09:17:07 By : emopink009
 

 
Code (PHP)

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2022-01-21 12:40:30 By : กดอ
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ต้องการโชว์ข้อมูลที่กรอกลงไปบนหน้าเว็บนึง เพื่อไปโชว์อีกหน้าเว็บนึง mysql php
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่