want to connect my php form with data base

  • Profile Image
    Abhinav
    Asked on August 08, 2016 at 07:32 AM

    want to connect my php form with data base

     



    This is a re-post of a comment on How to send Submissions to Your MySQL Database Using PHP

  • Profile Image
    Nik_C
    Answered on August 08, 2016 at 07:51 AM

    Did you check our guide for Sending submissions to MySQL database? Are you stuck in some part of it?

    Please let us know so we can be able to assist you.

    Thank you!

  • Profile Image
    Abhinav
    Answered on August 08, 2016 at 08:45 AM
    i create a application form but i cant be able to connect with data base
    and get output
    ...
  • Profile Image
    Kiran
    Answered on August 08, 2016 at 09:26 AM

    I have checked our records and was unable to find any accounts registered with your email address. Could you provide us with the form and the script that you are working on to send the form submission data to MySQL so that we can take a look and provide you with necessary assistance?

    Also, please provide us with more information on the issue or any error message that you are receiving that would be helpful in isolating the issue quickly.

    We will wait for your response. Thank you! 

  • Profile Image
    Abhinav
    Answered on August 08, 2016 at 01:45 PM
    this is my code tell me what to do
    <?php
    if ( isset( $_POST['submit'] ) ){
    global $wpdb;
    $table = 'wp3_tm_details';
    $data = array(
    'application_date' => $_POST['application_date'],
    'user_id'
    => $_POST['user_id'],
    'tm_service_type' => $_POST['tm_service_type'],
    'tm_name'
    => $_POST['tm_name'],
    'tm_address' => $_POST['tm_address'],
    'tm_location' => $_POST['tm_location'],
    'tm_class'
    => $_POST['tm_class'],
    'tm_logo'
    => $_POST['tm_logo'],
    'brand_start_date' => $_POST['brand_start_date'],
    );
    $format = array(
    '%s'
    //'%s'
    );
    $success=$wpdb->insert( $table, $data, $format );
    if($success){
    $print=$wpdb->get_results( "SELECT * FROM wp3_tm_details where
    user_id=".$_POST['user_id']." order by tm_id desc limit 1");
    foreach($print as $row) {
    //header("Location: http://erp.spacehal.com/?page_id=11"); }
    header("Location: http://erp.spacehal.com/?page_id=11
    ?".$_POST['id']."=".$row->tm_id); }
    /*
    $print=$wpdb->get_results( "SELECT * FROM wp3_tm_details where
    user_id=".$_POST['user_id']." order by tm_id desc limit 1");
    echo 'Data has been Saved';echo"
    " ;echo"
    " ;
    echo
    "

    ";echo 'Your TM ID no is: ' ; foreach($print as $row)
    {
    echo "".
    $row->tm_id ."
    ";
    }
    echo
    "
    ";echo 'Date of Application: ' ; echo $_POST['application_date'];
    echo
    "
    ";echo 'Type of Application: ' ; echo $_POST['tm_service_type'];
    echo
    "
    ";echo 'Clinet ID: ' ; echo $_POST['user_id'];
    echo
    "
    ";echo 'Trademark Name (To be Registered): ' ; echo $_POST['tm_name'];
    echo
    "
    ";echo 'Business Address of Brand: ' ; echo $_POST['tm_address'];
    echo
    "
    ";echo 'City: ' ; echo $_POST['tm_location'];
    echo
    "
    ";echo 'TM Registration Class Applied: ' ; echo $_POST['tm_class'];
    echo
    "
    ";echo 'TM Lable: ' ; echo $_POST['tm_logo'];
    echo
    "
    ";echo 'Business Start Date: ' ; echo $_POST['brand_start_date'];
    */
    }
    else {
    echo "Error, Please check the code";
    }
    }
    else {
    ?>


    <?=$error['user_id']?>

    Client ID
    No.:value="<?=($_POST['user_id'] ? htmlentities($_POST['user_id']) : '')?>" />
    <?=$error['tm_service_type']?>

    for="tm_service_type">Type of Services:
    name="tm_service_type" value="Application" /> New Application
    name="tm_service_type" value="Search" /> Search
    name="tm_service_type" value="Renew" /> Renew
    name="tm_service_type" value="Opposition" /> Opposition
    <?=$error['tm_name']?>

    for="tm_name">Trademark Name(To be Registered):id="tm_name" name="tm_name" value="<?=($_POST['tm_name'] ?
    htmlentities($_POST['tm_name']) : '')?>" />
    <?=$error['tm_address']?> for="tm_address">Address of Business:id="tm_address" name="tm_address" value="<?=($_POST['tm_address'] ?
    htmlentities($_POST['tm_address']) : '')?>" />
    <?=$error['tm_location']?> for="tm_location">City of Business Head Office:id="tm_location" name="tm_location" value="<?=($_POST['tm_location'] ?
    htmlentities($_POST['tm_location']) : '')?>" />
    <?=$error['brand_start_date']?>

    for="brand_start_date">Business / Brand Start Date :type="date" id="brand_start_date" name="brand_start_date"
    value="<?=($_POST['brand_start_date'] ?
    htmlentities($_POST['brand_start_date'])
    : '')?>" />
    <?=$error['tm_class']?>

    for="tm_class">TM Registration Class:id="tm_class" name="tm_class" value="<?=($_POST['tm_class'] ?
    htmlentities($_POST['tm_class']) : '')?>" />
    <?=$error['tm_logo']?>

    TM Lable/
    Logo:value="<?=($_POST['tm_logo'] ? htmlentities($_POST['tm_logo']) : '')?>" />
    <?=$error['application_date']?>

    for="application_date">TM Application Date
    :id="application_date" name="application_date"
    value="<?=($_POST['application_date']
    ? htmlentities($_POST['application_date']) : '')?>" />

    />



    <?php } ?>
    ...
  • Profile Image
    Irshad
    Answered on August 08, 2016 at 02:04 PM

    Thanks for sharing the code. I checked your email address in our system. But seems you have not created the account by this email address. and because of that, I am unable to find Forms on which you are working.

    Can you please send us your Form URLs, on which you are working. Thanks.