Click here to Skip to main content
15,889,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<?php /*Template name: gold loan enquiry */


get_header(); ?>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
    $(document).ready(function() {

  $("#source").change(function() {

    var el = $(this).children("option:selected").val();
    
    if(el == "loan" ) {
    $("#status").show();
    } else {
    $("#status").hide();
    }
  });
  document.getElementById('box').onchange = function(){
    if(this.checked) alert("You receive calls");
    else alert("You dont receive any calls");
};

});

    </script>
    <style>
        .loans img{ display: none; }
    </style>
 <!-- breadcumb-area start -->
 <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
        <div class="breadcumb-area black-opacity bg-img-3" style="background-image: url('<?php echo $backgroundImg[0]; ?>'); background-position: initial;">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="breadcumb-wrap">
                            <h2><?php the_title(); ?></h2>
                        </div>
                    </div>
                </div>
            </div>
            <div class="breadcumb-menu">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12">
                            <ul>
                                <li><a href="<?php echo site_url(); ?>">Home </a></li>
                                 <li>/</li>
                                <li><?php the_title(); ?></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- breadcumb-area end -->
<section class="inner-area">
            <div class="container">
                <div class="row">

         <div class="col-md-12">
                  <div class="section-title text-center wow fadeInUp">
                            <h2><?php the_title(); ?></h2>
                                                    </div>
                <div class="col-md-7 remove-thum-img"><?php the_post_thumbnail($post_id, array( 50, 50) ); ?> </div>

        <?php
        // Start the loop.
        while ( have_posts() ) : the_post();

            // Include the page content template.
            get_template_part( 'template-parts/content', 'page' );

            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) {
                comments_template();
            }

            // End of the loop.
        endwhile;
        ?>
        <br>
        <div class="row">
     
                                                    
        <div class="col-md-7 col-xs-12 fadeInRight wow">
          <p style="text-align: left;">Enquire Now:</p>
                        <div class="faq-form thumbnail well" style="padding: 20px 20px 3px 0;">
                            <div class="cf-msg"></div>
                            <form class="form-horizontal" id="cf" action="">
                  <div class="form-group">
                     <label class="control-label col-sm-6">Name:</label>
                     <div class="col-sm-6">
                        <input type="text" class="form-control" name="namess" required>
                     </div>
                  </div>

                  <div class="form-group">
                     <label for="phoneno" class="control-label col-sm-6">Mobile Number:</label>
                     <div class="col-sm-6">
                       <input type="tel" class="form-control" name="phone" id="phoneno" pattern="[0-9]*" maxlength="10" required>
                     </div>
                  </div>
                  <div class="form-group">
                     <label for="acn" class="control-label col-sm-6">Customer with branch & A/c No:</label>
                     <div class="col-sm-6">
                       <input type="text" class="form-control" name="account" required>
                     </div>
                  </div>
                  <div class="form-group">
                     <label for="feedback" class="control-label col-sm-6">Feedback/Grievance details</label>
                     <div class="col-sm-6">
                       <textarea class="form-control" name="feedback" required></textarea>
                     </div>
                  </div>
                  <div class="form-group">
                     <div class="col-sm-offset-6 col-sm-6">
                        <button type="submit" name="submit" value="submit" class="btn btn-primary">Submit</button>
                     </div>
                  </div>
               </form>
	
                        </div>
                    </div>

					<?php  
    global $wpdb;
	 if(isset($_REQUEST["submit"])){
	$namess=$_REQUEST["namess"];
    $phone=$_REQUEST["phone"];
	$account=$_REQUEST["account"];
    $feedback=$_REQUEST["feedback"];
	
		$to='kuldeep.kaluvala@gmail.com'; // Receiver Email ID, Replace with your email ID
		$subject='Form Submission';
		$message="Name :".$name."\n"."Phone :".$phone."\n"."Wrote the following :"."\n\n".$msg;
		$headers="From: ".$email;

		if(mail($to, $subject, $message, $headers)){
			echo "<h1>Sent Successfully! We will contact you shortly!</h1>";
		}
		else{
			echo "Something went wrong!";
		}
	
	
	$sql="insert into grievance_enquiry (namess,phone,account,feedback)values('".$namess."','".$phone."','".$account."','".$feedback."')";
	 
	$status = $wpdb->query($sql);
   
	
	if($status>0){
			echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
		}
			
}

?>
                  </div>
               
        </div>
         </div>

            </div>
        </section>
<?php get_footer(); ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker3.min.css">
    <script type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.min.js"></script>
<script type='text/javascript'>
$(function(){
$('.input-group.date').datepicker({
  format: 'yyyy-mm-dd',
     minViewMode: 0,
    calendarWeeks: true,
    todayHighlight: true,
    autoclose: true
});  
});

</script>


What I have tried:

Please help me quickly i should close this issue as soon as possible
Posted
Updated 16-Jun-19 22:00pm

Compiling does not mean your code is right! :laugh:
Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email contained the message you wanted to send.

So now you enter the second stage of development (in reality it's the fourth or fifth, but you'll come to the earlier stages later): Testing and Debugging.

Start by looking at what it does do, and how that differs from what you wanted. This is important, because it give you information as to why it's doing it. For example, if a program is intended to let the user enter a number and it doubles it and prints the answer, then if the input / output was like this:
Input   Expected output    Actual output
  1            2                 1
  2            4                 4
  3            6                 9
  4            8                16
Then it's fairly obvious that the problem is with the bit which doubles it - it's not adding itself to itself, or multiplying it by 2, it's multiplying it by itself and returning the square of the input.
So with that, you can look at the code and it's obvious that it's somewhere here:
C#
int Double(int value)
   {
   return value * value;
   }

Once you have an idea what might be going wrong, start using the debugger to find out why. Put a breakpoint on the first line of the method, and run your app. When it reaches the breakpoint, the debugger will stop, and hand control over to you. You can now run your code line-by-line (called "single stepping") and look at (or even change) variable contents as necessary. If you don't know what a debugger is, or how to use it, then start here: php debugger - Google Search[^]
Think about what each line in the code should do before you execute it, and compare that to what it actually did when you use the "Step over" button to execute each line in turn. Did it do what you expect? If so, move on to the next line.
If not, why not? How does it differ?
Hopefully, that should help you locate which part of that code has a problem, and what the problem is.
This is a skill, and it's one which is well worth developing as it helps you in the real world as well as in development. And like all skills, it only improves by use!
 
Share this answer
 
v2
PHP
$sql="insert into grievance_enquiry (namess,phone,account,feedback)values('".$namess."','".$phone."','".$account."','".$feedback."')";

Not necessary a solution to your question, but another problem you have.
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[^]
SQL Injection[^]
SQL Injection Attacks by Example[^]
PHP: SQL Injection - Manual[^]
SQL Injection Prevention Cheat Sheet - OWASP[^]
How can I explain SQL injection without technical jargon? - Information Security Stack Exchange[^]

By the way: Do you what is a debugger?
Quote:
i dont know bro about debugger and how to use

Your code do not behave the way you expect, or you don't understand why !

There is an almost universal solution: Run your code on debugger step by step, inspect variables.
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't know what your code is supposed to do, it don't find bugs, it just help you to by showing you what is going on. When the code don't do what is expected, you are close to a bug.
To see what your code is doing: Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute.

Debugger - Wikipedia, the free encyclopedia[^]

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Basic Debugging with Visual Studio 2010 - YouTube[^]

phpdbg | php debugger[^]
Debugging techniques for PHP programmers[^]

The debugger is here to only show you what your code is doing and your task is to compare with what it should do.
 
Share this answer
 
v3
Comments
Member 14502621 17-Jun-19 4:47am    
i dont know bro about debugger and how to use

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900