select
test
``` if(isset($_POST["submit"])) { // Step 1: Capture the user input $input = $_POST['table']; // Assuming the form field name is "input_field" // Step 2: Define the regular expression pattern to match English characters $pattern = '/^[a-zA-Z\s]+$/'; // Step 3: Validate the input against the pattern if (preg_match($pattern, $input)) { // The input contains only English characters // Proceed with further processing or database operations // ... $table = $_POST['table']; // SQL to Create a table in the selected database $sql = "CREATE TABLE $table ( id INT PRIMARY KEY AUTO_INCREMENT, firstname VARCHAR(225), content TEXT, user_id INT, FOREIGN KEY (user_id) REFERENCES test(test_id) )"; if ($con->query($sql) === TRUE) { $msg="تم انشاء قاعدة بيانات جديدة بإسم $table" ; } else { $error="حدث خطأ اثناء انشاء جدول في قاعدة البيانات"; } }else { // The input contains non-English characters $error="يرجى ادخال اسم جدول قاعدة البيانات المحدد باللون الأحمر باللغة الأنجليزية فقط"; } } $firstname = $_POST['firstname']; if(isset($_POST['firstname'])) { $order="INSERT INTO test (firstname,test_id) VALUES ('$firstname','$test_id')"; if ($con->query($order) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $order . "<br>" . $con->error; } } $con->close(); ?> ```
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)