Храните данные регистрационной формы и несколько файлов в MySQL и PHP - PullRequest
0 голосов
/ 25 сентября 2019

Я создал регистрационную форму и хочу сохранить данные в MySQL, когда пользователь нажимает кнопку «Отправить».Но я получаю ошибку при загрузке данных в MySQL.Мне нужно несколько изображений, а также файл и другие данные для хранения в базе данных после того, как пользователь заполнил все детали.

Моя созданная регистрационная HTML-форма, в которой вы можете видеть все детали, которые я пытаюсь загрузить, и вы можете помочь мне с этим.

ФОРМА HTML

                    <form action="upload.php" method="post" id="regform">
                        <div class="row" style="margin-top: 50px;">
                            <div class="col-md-6">
                                <input type="text" class="form-control" id="name" name="name" placeholder="Enter name" required />
                            </div>
                            <div class="col-md-6">
                                <input type="text" class="form-control" id="gender" name="gender" placeholder="Gender" required />
                            </div>
                            <div class="col-md-6">
                                <input type="number" class="form-control" id="mobile" name="mobile" placeholder="Mobile Number" required />
                            </div>
                            <div class="col-md-6">
                                <input type="text" class="form-control" id="email" name="email" placeholder="Email" required />
                            </div>
                            <div class="col-md-6">
                                <input type="text" class="form-control" id="address" name="address" placeholder="Enter Your Full Address" required />
                            </div>
                            <div class="col-md-6">
                                <input type="text" class="form-control" id="perfoming" name="perfoming" placeholder="Performing Since" required />
                            </div>

                            <div class="col-md-6" style="margin-top: 20px;">
                                <h3>Category</h3>
                            </div>
                            <div class="col-md-6"></div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="bollywood" value="Bollywood"> Bollywood DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="techno" value="Techno"> Techno DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="trap" value="Trap"> Trap DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="trance" value="Bollywood"> Trance DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="bigroom" value="Techno"> Big Room DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="hiphop" value="Trap"> Hip Hop DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="housemusic" value="Bollywood"> House Music DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="substep" value="Techno"> Dubstep DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="retro" value="Trap"> Retro DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="psytrance" value="Bollywood"> Psy-Trance DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px;">
                                <input type="checkbox" name="turntablist" value="Techno"> Turntablist DJ<br>
                            </div>
                            <div class="col-md-4" style="margin-top: 5px; margin-bottom: 20px;">
                                <input type="checkbox" name="other" value="Trap"> Any Other<br>
                            </div>
                            <div class="col-md-6">
                                <input class="form-control" id="image" type="file" accept="image/*" name="image" />
                            </div>
                            <div class="col-md-6">
                                <input class="form-control" id="image1" type="file" accept="image/*" name="image1" />
                            </div>
                            <div class="col-md-6">
                                <input class="form-control" id="image2" type="file" accept="image/*" name="image2" />
                            </div>
                            <div class="col-md-6">
                                <input class="form-control" id="attach_file" type="file" accept="image/*" name="attach_file" />
                            </div>
                            <div class="col-md-6">
                                <input type="url" class="form-control" id="facebook" name="facebook" placeholder="Facebook Url" required="" />
                            </div>
                            <div class="col-md-6">
                                <input type="url" class="form-control" id="twitter" name="twitter" placeholder="Twitter Url" required="" />
                            </div>
                            <div class="col-md-6">
                                <input type="url" class="form-control" id="instagram" name="instagram" placeholder="Instagram Url" required="" />
                            </div>
                            <div class="col-md-6">
                                <input type="text" class="form-control" id="about" name="about" placeholder="About Yourself" required />
                            </div>
                            <div class="col-md-12" style="background-color: #fff; color: #000; margin-top: 50px;">
                                    <input type="radio" name="platinum" value="amount"> Platinum 3000 <br>
                                    <input type="radio" name="gold" value="amount"> Gold 2000 <br>
                                    <input type="radio" name="silver" value="amount"> Silver 1000 <br>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <button type="submit" class="button-control" form="regform" value="Submit">Proceed to Payment</button>
                        </div>
                    </form>

Файл подключения к моей базе данных connection.php

       $servername = "localhost";  
       $username = "root";  
       $password = "";  
       $conn = mysqli_connect ($servername , $username , $password) or die("unable to connect to host");  
       $sql = mysqli_select_db ($conn,'test') or die("unable to connect to database"); 
?>   

Наконец, мой файл загрузки, которыйбросить, который я пытаюсь загрузить мои данные в MySQL.

Upload.php


<?php

require("connection.php");

$valid_extensions = array('jpeg', 'jpg', 'png', 'gif', 'bmp' , 'pdf' , 'doc' , 'ppt'); // valid extensions
$path = 'uploads/'; // upload directory
if(!empty($_POST['name']) || !empty($_POST['gender']) || !empty($_POST['mobile']) || || !empty($_POST['email']) !empty($_POST['address']) || !empty($_POST['performing']) || $_POST['bollywood'] || $_POST['techno'] || $_POST['trap'] || $_POST['trance'] || $_POST['bigroom'] || $_POST['hiphop'] || $_POST['housemusic'] || $_POST['substep'] || $_POST['retro'] || $_POST['psytrance'] || $_POST['turntablist'] || $_POST['other'] || !empty($_FILES['image']) || !empty($_FILES['image1']) || !empty($_FILES['image2']) || !empty($_FILES['attach_file']) || !empty($_POST['facebook']) || !empty($_POST['twitter']) || !empty($_POST['instagram']) || !empty($_POST['about']) || $_POST['platinum'] || $_POST['gold'] || $_POST['silver'])
{

$img1 = $_FILES['image1']['name'];
$tmp = $_FILES['image1']['tmp_name'];
$img2 = $_FILES['image2']['name'];
$tmp = $_FILES['image1']['tmp_name'];
$img3 = $_FILES['image3']['name'];
$tmp = $_FILES['image1']['tmp_name'];
$file = $_FILES['attach_file']['name'];
$tmp = $_FILES['attach_file']['tmp_name'];


// get uploaded file's extension
$ext = strtolower(pathinfo($img1, PATHINFO_EXTENSION));
$ext1 = strtolower(pathinfo($img2, PATHINFO_EXTENSION));
$ext2 = strtolower(pathinfo($img3, PATHINFO_EXTENSION));
$ext3 = strtolower(pathinfo($file, PATHINFO_EXTENSION));
// can upload same image using rand function
$final_image = rand(1000,1000000).$img1;
$final_image = rand(1000,1000000).$img2;
$final_image = rand(1000,1000000).$img3;
$final_image = rand(1000,1000000).$file;

// check's valid format
if(in_array($ext, $ext1, $ext2, $ext3, $valid_extensions)) 
{ 
$path = $path.strtolower($final_image); 
if(move_uploaded_file($tmp,$path)) 
{
echo "<img src='$path' />";
$name = $_POST['name'];
$gender = $_POST['gender']; 
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$address = $_POST['address'];
$performing = $_POST['performing'];
$bollywood = $_POST['bollywood'];
$techno = $_POST['techno'];
$trap = $_POST['trap'];
$trance = $_POST['trance'];
$bigroom = $_POST['bigroom'];
$hiphop = $_POST['hiphop'];
$housemusic = $_POST['housemusic'];
$substep = $_POST['substep'];
$retro = $_POST['retro'];
$psytrance = $_POST['psytrance'];
$turntablist = $_POST['turntablist'];
$other = $_POST['other'];
$facebook = $_POST['facebook'];
$twitter = $_POST['twitter'];
$instagram = $_POST['instagram'];
$about = $_POST['about'];
$platinum = $_POST['platinum'];
$gold = $_POST['gold'];
$silver = $_POST['silver'];

//include database configuration file
include_once 'connection.php';
//insert form data in the database
$insert = $db->query("INSERT registration (name,gender,mobile,email,address,performing,performing,bollywood,techno,trap,trance,bigroom,hiphop,housemusic,substep,retro,psytrance,turntablist,other,facebook,twitter,instagram,about,platinum,gold,silver,image1,image2,image3,attach_file) VALUES ('".$name."','".$gender."','".$mobile."','".$email."','".$address."','".$performing."','".$bollywood."','".$techno."','".$trap."','".$trance."','".$bigroom."','".$hiphop."','".$housemusic."','".$substep."','".$retro."','".$psytrance."','".$turntablist."','".$other."','".$path."','".$path."','".$path."','".$path."','".$facebook."','".$twitter."','".$instagram."','".$about."','".$platinum."','".$gold."','".$silver."')");
//echo $insert?'ok':'err';
}
} 
else 
{
echo 'invalid';
}
}
?>

Я надеюсь, что кто-то может помочь мне с этим.

База данных и таблица MySQL:

CREATE TABLE `registration` (
  `id` int(8) NOT NULL,
  `name` varchar(25) NOT NULL,
  `gender` varchar(10) NOT NULL,
  `mobile` int(10) NOT NULL,
  `email` varchar(50) NOT NULL,
  `address` varchar(100) NOT NULL,
  `performing` varchar(20) NOT NULL,
  `bollywood` tinyint(10) NOT NULL,
  `techno` tinyint(10) NOT NULL,
  `trap` tinyint(10) NOT NULL,
  `trance` tinyint(10) NOT NULL,
  `birroom` tinyint(10) NOT NULL,
  `hiphop` tinyint(10) NOT NULL,
  `housemusic` tinyint(10) NOT NULL,
  `dubstep` tinyint(10) NOT NULL,
  `retro` tinyint(10) NOT NULL,
  `psytrance` tinyint(10) NOT NULL,
  `turntablist` tinyint(10) NOT NULL,
  `other` tinyint(10) NOT NULL,
  `image1` varchar(30) NOT NULL,
  `image2` varchar(30) NOT NULL,
  `image3` varchar(30) NOT NULL,
  `attach_file` varchar(30) NOT NULL,
  `facebook` varchar(100) NOT NULL,
  `twitter` varchar(100) NOT NULL,
  `instagram` varchar(100) NOT NULL,
  `about` varchar(500) NOT NULL,
  `platinum` varchar(20) NOT NULL,
  `gold` varchar(20) NOT NULL,
  `silver` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Я поражен этим за последние 2 дня, пробовал и менял код, а также осуществлял поиск в Google, но ничего не мог с собой поделать.

1 Ответ

0 голосов
/ 25 сентября 2019

Исходный код был настолько несовершенен, что сделал его практически непригодным для использования - неправильный HTML, уязвимости в SQL-инъекциях, плохая структура таблиц базы данных и, очевидно, ошибки, которые привели вас к Stack.

Я бы посоветовал вам изменить структуру таблицы следующим образом:

create table `registration` (
    `id` int(10) unsigned not null auto_increment,
    `name` varchar(25) not null,
    `gender` varchar(10) not null,
    `mobile` varchar(50) not null,
    `email` varchar(50) not null,
    `address` varchar(100) not null,
    `performing` varchar(20) not null,
    `bollywood` bit(1) null default null,
    `techno` bit(1) null default null,
    `trap` bit(1) null default null,
    `trance` bit(1) null default null,
    `bigroom` bit(1) null default null,
    `hiphop` bit(1) null default null,
    `housemusic` bit(1) null default null,
    `dubstep` bit(1) null default null,
    `retro` bit(1) null default null,
    `psytrance` bit(1) null default null,
    `turntabulist` bit(1) null default null,
    `other` bit(1) null default null,
    `image` varchar(128) not null,
    `image1` varchar(128) not null,
    `image2` varchar(128) not null,
    `attach_file` varchar(128) not null,
    `facebook` varchar(100) not null,
    `twitter` varchar(100) not null,
    `instagram` varchar(100) not null,
    `about` varchar(500) not null,
    `amount` varchar(20) not null,
    primary key (`id`)
)
collate='utf8_general_ci'
engine=innodb;

Существуют и другие улучшения, которые можно и, вероятно, следует сделать, но пока этого должно быть достаточно.Обратите внимание на новый столбец amount - он заменяет предыдущие silver, gold и platinum - элемент поля HTML был переключателем, но имя элемента фактически было тем, что должно было быть значением ~обратное имя и значение для правильной работы.

Другие изменения заключаются в том, что различные поля не обязательно должны быть tinyint, когда они хранят только 1, 0 или ноль - следовательно, выбирая BIT в качестве полятип.Столбец id был назначен как primary key.

В коде HTML и PHP также есть несколько изменений, чтобы заставить его работать так, как я подозреваю, это было задумано.

<code><?php

    error_reporting( E_ALL );
    ini_set( 'display_errors', 1 );


    /* change this to include YOUR db connection or edit as appropriate */
    $dbhost =   '127.0.0.1';
    $dbuser =   'root'; 
    $dbpwd  =   'xxx'; 
    $dbname =   'xxx';
    $db = new mysqli( $dbhost, $dbuser, $dbpwd, $dbname );





    if( $_SERVER['REQUEST_METHOD']=='POST' ){

        function uploaderror( $error ){ 
            switch( $error ) { 
                case UPLOAD_ERR_INI_SIZE: return "The uploaded file exceeds the upload_max_filesize directive in php.ini"; 
                case UPLOAD_ERR_FORM_SIZE: return "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"; 
                case UPLOAD_ERR_PARTIAL: return "The uploaded file was only partially uploaded"; 
                case UPLOAD_ERR_NO_FILE: return "No file was uploaded"; 
                case UPLOAD_ERR_NO_TMP_DIR: return "Missing a temporary folder"; 
                case UPLOAD_ERR_CANT_WRITE: return "Failed to write file to disk"; 
                case UPLOAD_ERR_EXTENSION: return "File upload stopped by extension"; 
                default: return "Unknown upload error";
            }
        }

        $status=null;
        $errors=[];

        $valid_extensions = array('jpeg', 'jpg', 'png', 'gif', 'bmp' , 'pdf' , 'doc' , 'ppt');




        /* Edit as appropriate */
        $path = 'c:/temp/fileuploads/stack/';   #   'uploads/'




        /* all mandatory fields */
        $required=array(
            'name'              =>  FILTER_SANITIZE_STRING,
            'gender'            =>  FILTER_SANITIZE_STRING,
            'mobile'            =>  FILTER_SANITIZE_STRING,
            'email'             =>  FILTER_SANITIZE_STRING,
            'address'           =>  FILTER_SANITIZE_STRING,
            'performing'        =>  FILTER_SANITIZE_STRING,
            'facebook'          =>  FILTER_SANITIZE_STRING, 
            'twitter'           =>  FILTER_SANITIZE_STRING, 
            'instagram'         =>  FILTER_SANITIZE_STRING, 
            'about'             =>  FILTER_SANITIZE_STRING,
            'amount'            =>  FILTER_SANITIZE_STRING
        );
        /* Probably at least 1 is required */
        $optional=array(
            'bollywood'         =>  FILTER_SANITIZE_NUMBER_INT,
            'techno'            =>  FILTER_SANITIZE_NUMBER_INT,
            'trap'              =>  FILTER_SANITIZE_NUMBER_INT,
            'trance'            =>  FILTER_SANITIZE_NUMBER_INT,
            'bigroom'           =>  FILTER_SANITIZE_NUMBER_INT,
            'hiphop'            =>  FILTER_SANITIZE_NUMBER_INT,
            'housemusic'        =>  FILTER_SANITIZE_NUMBER_INT,
            'substep'           =>  FILTER_SANITIZE_NUMBER_INT,
            'retro'             =>  FILTER_SANITIZE_NUMBER_INT,
            'psytrance'         =>  FILTER_SANITIZE_NUMBER_INT,
            'turntabulist'      =>  FILTER_SANITIZE_NUMBER_INT,
            'other'             =>  FILTER_SANITIZE_NUMBER_INT
        );

        /* all required */
        $filefields=array(
            'image',
            'image1',
            'image2',
            'attach_file'
        );

        /* Ensure that all the required fields are populated */
        foreach( array_keys( $required ) as $key ){
            try{
                if( !isset( $_POST[ $key ] ) ) throw new Exception( sprintf( 'The field "%s" cannot be empty', $key ) );
            }catch( Exception $e ){
                $errors[]=$e->getMessage();
                continue;
            }
        }

        /* Ensure that all image fields are populated */
        foreach( $filefields as $field ){
            try{
                if( empty( $_FILES[ $field ] ) ) throw new Exception( sprintf( 'The file field "%s" is required', $field ) );
            }catch( Exception $e ){
                $errors[]=$e->getMessage();
                continue;
            }
        }




        if( empty( $errors ) ){

            $sql='insert into `registration`
                ( `name`,`gender`,`mobile`,`email`,`address`,`performing`,`bollywood`,`techno`,`trap`,`trance`,`bigroom`,`hiphop`,`housemusic`,`dubstep`,`retro`,`psytrance`,`turntabulist`,`other`,`facebook`,`twitter`,`instagram`,`about`,`amount`,`image`,`image1`,`image2`,`attach_file` )
                values
                ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? )';

            $stmt=$db->prepare( $sql );
            if( !$stmt ) {
                /* Investigate errors and make corrections to db table &/or sql statement */
                exit( sprintf( 'Bad Foo! - %s', $db->error )  );
            }
            $stmt->bind_param(
                'ssssssiiiiiiiiiiiisssssssss',
                $name,
                $gender,
                $mobile,
                $email,
                $address,
                $performing,
                $bollywood,
                $techno,
                $trap,
                $trance,
                $bigroom,
                $hiphop,
                $housemusic,
                $dubstep,
                $retro,
                $psytrance,
                $turntabulist,
                $other,
                $facebook,
                $twitter,
                $instagram,
                $about,
                $amount,
                $image,
                $image1,
                $image2,
                $attach_file
            );



            $images=array();

            foreach( $filefields as $index => $field ){
                try{
                    /* assign a variable variable - cast as an object for convenience */
                    $obj=(object)$_FILES[ $field ];

                    if( isset( $obj ) ){

                        /* get details of the file */
                        $name=$obj->name;
                        $ext=strtolower( pathinfo( $name, PATHINFO_EXTENSION ) );
                        $tmp=$obj->tmp_name;
                        $size=$obj->size;
                        $error=$obj->error;

                        if( !in_array( $ext, $valid_extensions ) ) throw new Exception( sprintf('The file "%s" has an illegal file extension "%s"',$name,$ext ) );


                        if( $error==UPLOAD_ERR_OK && is_uploaded_file( $tmp ) ){

                            /* create the final name for the file to be saved */
                            $saveas = sprintf( '%s/%d.%s', $path, mt_rand( 1000, 1000000 ), $name );
                            $bytes  = move_uploaded_file( $tmp, $saveas );

                            if( $bytes ){
                                $images[ $field ]=(object)array(
                                    'name'  =>  $name,
                                    'size'  =>  $size
                                );                              
                            } else {
                                throw new Exception( sprintf( 'There was an error storing "%s"', $name ) );
                            }
                        } else {
                            throw new Exception( sprintf( 'There was a problem with "%s" - %s', $name, uploaderror( $error ) ) );
                        }
                    }
                }catch( Exception $e ){
                    $errors[]=$e->getMessage();
                    continue;
                }
            }




            $args=array_merge( $required, $optional );
            filter_input_array( INPUT_POST, $args );
            extract( $_POST );



            foreach( $filefields as $field ){
                ${$field}=$images[ $field ]->name;
            }



            if( empty( $errors ) ){
                $status=$stmt->execute();
                if( $stmt->errno!= 0 ) exit( sprintf( 'Critical Error: [%d] - %s',$stmt->errno,$stmt->error) );
                $stmt->close();
            }



        }
    }
?>
<!DOCTYPE html>
<html lang='en'>
    <head>
        <meta charset='utf-8' />

    </head>
    <body>
        <?php
            if( $_SERVER['REQUEST_METHOD']=='POST' ){
                if( !empty( $status ) ){

                    $message = $status ? 'success: record added' : 'failure: record was not added';
                    $colour  = $status ? 'green' : 'red';

                    printf('<span style="color:%s">%s</span>', $colour, $message );
                }
            }
        ?>
        <form method='post' enctype='multipart/form-data'>
            <div class='row' style='margin-top: 50px;'>
                <div class='col-md-6'>
                    <input type='text' class='form-control' id='name' name='name' placeholder='Enter name' required />
                </div>
                <div class='col-md-6'>
                    <input type='text' class='form-control' id='gender' name='gender' placeholder='Gender' required />
                </div>
                <div class='col-md-6'>
                    <input type='number' class='form-control' id='mobile' name='mobile' placeholder='Mobile Number' required />
                </div>
                <div class='col-md-6'>
                    <input type='text' class='form-control' id='email' name='email' placeholder='Email' required />
                </div>
                <div class='col-md-6'>
                    <input type='text' class='form-control' id='address' name='address' placeholder='Enter Your Full Address' required />
                </div>
                <div class='col-md-6'>
                    <input type='text' class='form-control' id='performing' name='performing' placeholder='Performing Since' required />
                </div>

                <div class='col-md-6' style='margin-top: 20px;'>
                    <h3>Category</h3>
                </div>


                <div class='col-md-6'></div>


                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='bollywood' value='1'> Bollywood DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='techno' value='1'> Techno DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='trap' value='1'> Trap DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='trance' value='1'> Trance DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='bigroom' value='1'> Big Room DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='hiphop' value='1'> Hip Hop DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='housemusic' value='1'> House Music DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='dubstep' value='1'> dubstep dj<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='retro' value='1'> Retro DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='psytrance' value='1'> Psy-Trance DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px;'>
                    <input type='checkbox' name='turntabulist' value='1'> Turntabulist DJ<br>
                </div>
                <div class='col-md-4' style='margin-top: 5px; margin-bottom: 20px;'>
                    <input type='checkbox' name='other' value='1'> Any Other<br>
                </div>


                <div class='col-md-6'>
                    <input class='form-control' type='file' accept='image/*' name='image' />
                </div>
                <div class='col-md-6'>
                    <input class='form-control' type='file' accept='image/*' name='image1' />
                </div>
                <div class='col-md-6'>
                    <input class='form-control' type='file' accept='image/*' name='image2' />
                </div>
                <div class='col-md-6'>
                    <input class='form-control' type='file' accept='image/*' name='attach_file' />
                </div>


                <div class='col-md-6'>
                    <input type='url' class='form-control' id='facebook' name='facebook' placeholder='Facebook Url' required />
                </div>
                <div class='col-md-6'>
                    <input type='url' class='form-control' id='twitter' name='twitter' placeholder='Twitter Url' required />
                </div>
                <div class='col-md-6'>
                    <input type='url' class='form-control' id='instagram' name='instagram' placeholder='Instagram Url' required />
                </div>
                <div class='col-md-6'>
                    <input type='text' class='form-control' id='about' name='about' placeholder='About Yourself' required />
                </div>


                <div class='col-md-12' style='background-color: #fff; color: #000; margin-top: 50px;'>
                        <input type='radio' name='amount' value='platinum'> Platinum 3000 <br>
                        <input type='radio' name='amount' value='gold'> Gold 2000 <br>
                        <input type='radio' name='amount' value='silver'> Silver 1000 <br>
                </div>


            </div>
            <div class='col-md-12'>
                <input type='submit' />
            </div>
        </form>
        <?php
            if( $_SERVER['REQUEST_METHOD']=='POST' ){
                /* were there any errors? display them perhaps... */
                if( !empty( $errors ) ) printf( '<pre>%s
', print_r ($ errors, true));}?>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...