Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
<?php
include "inc/head.php";


if(isset($_POST['submit']))
{	$user_code = $_REQUEST['user_code'];
     $code = $_REQUEST['code'];
    if($code == $user_code)

	{
	$name  = $_REQUEST['your_name'];
	$email = $_REQUEST['your_email'];
	$phone = $_REQUEST['your_phone'];
	$message = $_REQUEST['comments'];
	$created_date  = date('Y-m-d');
	$created_time  = date('h:i:s A');

	$data=array(
		'name'=>$name,
		'email'=>$email,
		'phone'=>$phone,
		'message'=>$message,
		'created_date'=>$created_date,
		'created_time'=>$created_time
	);
	
	$lastid=$obj->insert('tbl_contactus',$data,"id='".$lastid."'");
	
			$to ='info@code2dev.com';
			$subject = "Contact Us page query";
			$header = "From:".$email."\r\n";
			$header .= "MIME-Version: 1.0\r\n";
			$header .= "Content-type: text/html\r\n";
			$site_path=BASEPATH;
			$message='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
			<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<title>Code2Dev Technologies Contact Form</title>
			<style type="text/css">@charset "utf-8";</style>
			</head>
			<body>
			<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
			<tr>
				<td style="padding:40px 0px 40px 0px;background-color:#f4f4f4;">
			  <table width="702" cellpadding="0" cellspacing="0" border="0" align="center" bgcolor="#FFFFFF">
			  <tr> 
				<td width="700" bgcolor="#f4f4f4">
				  <table width="700" cellpadding="0" cellspacing="0" border="0" align="center" bgcolor="#FFF">
				  <tr>
					<td width="100%" align="center" bgcolor="rgb(184,34,45)" style="padding:0 0px 0 0px;" colspan="3">
						<a href="'.$site_path.'" target="_blank"><h3 style="color:#fff;">Code2Dev Technologies Pvt. Ltd.</h3></a>
					</td>
				  </tr>
				  <tr> 
					<td width="1" bgcolor="#dadada"></td> 
					<td width="697" align="center">
						<table width="696" cellspacing="0" cellpadding="1" border="0" bgcolor="#FFFFFF">
							<tr> <td> 
							<div class="dataDiv" style="color:#666666;font-family:Lucida Grande,Lucida Sans,Lucida Sans Unicode,Arial,Helvetica,Verdana,sans-serif;font-size:12.5px;line-height:1.75em;padding:0 60px;">
							<br>
								Dear Admin,
								<br><br>	
								'.$name.' Sending You Query from Code2dev Contact Page Form.
								<br><br>Below is your details: <br>
								Name :  '.$name.' <br>
								Email :  '.$email.' <br>
								Mobile :  '.$phone.' <br>
								message :  '.$message.' <br>
								Date/Time :  '.date('d-m-Y').'<br>'.date('h:i:s A').' <br><br>
							</div>
							</td>
							</tr>
						</table>
					</td>
					<td width="1" bgcolor="#dadada"></td> 
					</tr> 
				  </table>
				</td>
			   </tr>
			   <td style="font-family:Arial,Helvetica,sans-serif;font-size:16px;color:#fff;border:1px solid #d1d1d1;text-align:center" width="100%" valign="top">
					<table style="background:#eee;border-bottom:1px solid #d1d1d1" width="100%" cellspacing="0" cellpadding="0" border="0">
				  <tbody>
				  <tr>
					<td style="width:100%;font-family:Arial,Helvetica,sans-serif;font-size:13px;color:#2e3192;text-align:center;padding:7px 5px 7px 5px;background:rgb(255,204,0);font-weight:bold">Happy to Help</td>
				  </tr>
				</tbody>
				</table>
				<table width="100%" cellspacing="0" cellpadding="0" border="0">
				  <tbody>
					<tr>
						<td style="width:50%;font-family:Arial,Helvetica,sans-serif;font-size:13px;line-height:18px;color:#000;padding:5px;text-align:center;border-right:1px solid #d1d1d1" width="50%">
							Phone: <a href="tel:+919717119392" style="color:#444" target="_blank">+91 874-499-6669</a>   Email: <a href="mailto:info@code2dev.com" style="color:#444" target="_blank">info@code2dev.com</a>
						</td>
					 </tr>
				</tbody>
				</table>
				</td>
			  </table>
			  <table width="700" border="0" cellpadding="0" cellspacing="0" bgcolor="#68686a" style="height:10px;line-height:10px;font-size:10px;" align="center">
				<tr>
				<td align="center" valign="top" style="height:10px;line-height:10px;font-size:10px;padding:0px 0 0px 0;background-color:#000;">
					<div id="footerDiv" style=" font-family:Lucida Grande,Arial,Helvetica,Geneva,Verdana,sans-serif;color:#FFFFFF;font-size:12px;line-height:1em;text-align:center;padding:8px 10px 12px 10px;">
						Copyright © <a href="'.$site_path.'" style="text-decoration:none; color:#fff;"> Code2Dev</a> '.date('Y').' All rights reserved. </div>
				</td>
				</tr>
				</table>  
			  </td>
			</tr>
			</table>
			</body>
			</html>';
			$mail = mail($to,$subject,$message,$header);
			/*
			//testing email is working or not
			if($mail == true){
			    echo "Thank You.";
			}else{
			    echo "Try Again.";
			}
			*/
			$suss_msg='<div class="alert alert-success"><div>Thank you! Your Query has been received! We will get back to you soon..!</div></div>';
		/* } */
	}
	
	else
	{
		$err_msg = '<div class="alert alert-danger"><div>Oops! Captcha code not correct.</div></div>';
	}
	
}
?>    
<style>
    p.captcha_cls {
    background: #faf0cd;
    padding: 10px 0px 10px 15px;
    font-size: 20px;
    font-weight: 900;
}
</style>
<body>

<div class="section is-header no-padding-bottom overflow-hidden bg-contact">
    <div class="c-contact1">
		<div class="c-contact1__icon"><a href="#" class="fa-regular"></a></div>
			<div class="c-contact1__wrapper">
				<div class="c-contact1_inner">
				    <?php
        				echo $suss_msg;
        				echo $err_msg; 
        			?>
				<?php echo $msg; ?>
				<h1>Hello, let's talk!</h1>
				<div class="margin-bottom-double low-text-contrast">Or come and drink coffee in comfy place and hangout with us</div>
					<div class="container container-nested">
						<div class="col lg-6">
							<div>
								Our Registered Address
								<br><?php echo $admin_info['address'];?>
							</div>
							<br>
							<span>
								<?php if(!empty($admin_info['tel3'])){ ?> Telephone <br> <?php echo $admin_info['tel3']; } ?>
							</span>
							<br>
							<br>
							<span>
								<?php if(!empty($admin_info['tel'])){ ?> Mobile <br> <?php echo $admin_info['tel']; } ?>
							</span>
            </div>
            <div class="col lg-6">
              <div>Office Hours<br><br>Monday—Friday<br>9:30am—7pm<br>
			  
				<br>
				<span>
					<?php

  if(!empty($admin_info['email'])){ ?> Email <br> <?php echo $admin_info['email']; } ?>
				</span>
							
			  </div>
            </div>
          </div>
          <div class="c-contact1__form ">
            <div class="margin-bottom">Or send us message:</div>
            
			<form name="contact-form" action="" method="POST" id="contact-form">
				<div class="form-group">
				<label for="Name">Name</label>
				<input type="text" class="form-control" name="your_name" placeholder="Name" required>
				</div>
				<div class="form-group">
				<label for="exampleInputEmail1">Email address</label>
				<input type="email" class="form-control" name="your_email" placeholder="Email" required>
				</div>
				<div class="form-group">
				<label for="Phone">Phone</label>
				<input type="text" class="form-control" name="your_phone" placeholder="Phone" required>
				</div>
				<div class="form-group">
				<label for="comments">Comments</label>
				<textarea name="comments" class="form-control" rows="3" cols="28" rows="5" placeholder="Comments" required></textarea> 
				</div>
				<div class="form-group">
				<p class="captcha_cls"><?php $code = 'c2d'.rand(1,10).''.rand(1,10); echo $code; ?></p>
				<input type="hidden" name="code" value="<?php echo $code; ?>">
				<label for="Phone">Enter Code of Above Box</label>
				<input type="text" name="user_code" class="form-control" placeholder="Enter Code" required>
				</div>
				<button type="submit" class="btn btn-primary" name="submit" value="Submit" id="submit_form">Submit</button>
			</form>
          </div>
        </div>
      </div>
    </div>
  </div>
<?php include "inc/footer.php";?>
PHP



What I have tried:

I HAVE TRIED SEVERAL THINGS TAKING REFERENCES FROM GOOGLE AND OTHER FILES.
Posted
Comments
Richard MacCutchan 18-Dec-21 3:47am    
Please use the Improve question link above, and add complete details of what is not working. And please do not shout; typing in all upper case is considered to be shouting on the internet.

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