Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php form is not submitting values in the database [closed]

Tags:

html

php

mysql

I made a form that has 26 fields including 6 images. Using the PHP language, I am submitting the the form using input type submit, then all the values are posted but entry in the database is not done.

It shows this error: G:\xampp\tmp\php9506.tmp

In the error, the number written in PHP, 9506, is random number, it changes each time I try to submit the form.

My database and connection file is correct.

What could the possible reasons for this be?

<?php
 include "header.php";
 include "left.php";

 $busi_cat = $_GET['mcatname'];



 if(isset($_POST) && $_POST['add'] == "Add")
 {


extract($_POST);

 $adver_type = implode(',',$adver_type);
 echo $busi_cat = $_GET['mcatname'];

if ($_FILES["photo1"]['tmp_name'] != "")
    {
        if(! file_exists("images/client"))
        {
        mkdir("images/client"); 
        }
        echo $source = $_FILES["photo1"]['tmp_name'];
        $photo1 = "images/client/".$_FILES["photo1"]['name'];

        if(move_uploaded_file($source, $photo1))
        {
            echo "image uploaded  succesfully"; 
        }
        else
        {
            echo "problem in uploading";    
        }
    }
    else
    {
        echo "please select a photo";   
    }

    if ($_FILES["photo2"]['tmp_name'] != "")
    {
        if(! file_exists("images/client"))
        {
        mkdir("images/client"); 
        }

        $source = $_FILES["photo2"]['tmp_name'];
        $photo2 = "images/client/".$_FILES["photo2"]['name'];

        if(move_uploaded_file($source, $photo2))
        {
            echo "image uploaded  succesfully"; 
        }
        else
        {
            echo "problem in uploading";    
        }
    }
    else
    {
        echo "please select a photo";   
    }

    if ($_FILES["photo3"]['tmp_name'] != "")
    {
        if(! file_exists("images/client"))
        {
        mkdir("images/client"); 
        }

        $source = $_FILES["photo3"]['tmp_name'];
        $photo3 = "images/client/".$_FILES["photo3"]['name'];

        if(move_uploaded_file($source, $photo3))
        {
            echo "image uploaded  succesfully"; 
        }
        else
        {
            echo "problem in uploading";    
        }
    }
    else
    {
        echo "please select a photo";   
    }

    if ($_FILES["photo4"]['tmp_name'] != "")
    {
        if(! file_exists("images/client"))
        {
        mkdir("images/client"); 
        }

        $source = $_FILES["photo4"]['tmp_name'];
        $photo4 = "images/client/".$_FILES["photo4"]['name'];

        if(move_uploaded_file($source, $photo4))
        {
            echo "image uploaded  succesfully"; 
        }
        else
        {
            echo "problem in uploading";    
        }
    }
    else
    {
        echo "please select a photo";   
    }

    if ($_FILES["photo5"]['tmp_name'] != "")
    {
        if(! file_exists("images/client"))
        {
        mkdir("images/client"); 
        }

        $source = $_FILES["photo5"]['tmp_name'];
        $photo5 = "images/client/".$_FILES["photo5"]['name'];

        if(move_uploaded_file($source, $photo5))
        {
            echo "image uploaded  succesfully"; 
        }
        else
        {
            echo "problem in uploading";    
        }
    }
    else
    {
        echo "please select a photo";   
    }

    if ($_FILES["photo6"]['tmp_name'] != "")
    {
        if(! file_exists("images/client"))
        {
        mkdir("images/client"); 
        }

        $source = $_FILES["photo6"]['tmp_name'];
        $photo6 = "images/client/".$_FILES["photo6"]['name'];

        if(move_uploaded_file($source, $photo6))
        {
            echo "image uploaded  succesfully"; 
        }
        else
        {
            echo "problem in uploading";    
        }
    }
    else
    {
        echo "please select a photo";   
    }




echo $query = "INSERT INTO register(busi_name, busi_cat, busi_scat, oth_busi_cat, addr, cont_per, phone, mobile, emailid, website, deal, keyword, message, adver_plan, photo1, photo2, photo3, photo4, photo5, photo6, status, full_page)VALUES('$busi_name', '$busi_cat', '$busi_scat', '$oth_busi_cat', '$addr', '$cont_per', '$phone', '$mobile', '$emailid', '$website', '$deal', '$keyword', '$message','$adver_type','$photo1','$photo2','$photo3','$photo4','$photo5','$photo6','0', '0')";
$res = mysql_query($query);
if($res)
    {
        $msg = "Your Business Added Successfully.";
    }
  }
   ?>
like image 775
atul tyagi Avatar asked May 07 '26 18:05

atul tyagi


1 Answers

May be you are using $_GET instead of $_POST. Try $_POST['element name']

I think the problem is in extract function.

like image 159
Yogesh Suthar Avatar answered May 10 '26 07:05

Yogesh Suthar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!