Good day. I want to send the values from the form to the server, write them to the database and get a simple answer.
index.php <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#but1").click(function(){ $("#par1").load("add.php","user=ввввй&phone=5"); }) }); </script> </head> <body> <p id="par1">После нажатия на кнопку в данном поле будет отображен результат выполнения скрипта add.php.</p> <input id="edit1" type="Edit" value="имя" /> <input id="edit2" type="Edit" value="телефон" /> <input id="but1" type="button" value="Передать данные скрипту" /> </body> </html>
<?php header ("Content-Type: text/html; charset=utf-8"); // подключаемся к серверу баз данных MySQL $db = new mysqli("localhost", "root", ""); // устанавливаем кодировку общения с MySQL $db->query("SET NAMES 'utf8'"); $db->select_db("myDataBase111"); $user = $_GET['user']; $phone = $_GET['phone']; echo "Имя: $name, Фамилия: $surname"; $db->query("INSERT INTO phones (fio, phone) VALUES ('$user','$phone')"); ?>
This data is sent and saved. But how can I get the values from edit1/edit2
and pass them on?
thank
phones
table is gone.” - etki