PHP contact form to be linked to api with email also being sent to mail id

51 views Asked by At

I have an issue with PHP form which is coded as follows

<?php
include "conn.php";
?>
<!DOCTYPE html>
<html>
<head>

    <title>Redbrick</title>
    <meta name="description" content="">
    <link rel="shortcut icon" href="images/favicon.ico" />
    <?php include "js-css.php"; ?>
    <meta charset="UTF-8">
    <script>
    var deleteid = 0;
    function deletefunc(del)
        {
            deleteid = del;
            $( "#deletedialog" ).dialog( "open" );
        }
        function deletethis()
            {
            $.post("delete.php?tab=careers", {deleteid : deleteid},
            function(data) {
                $('#deldiv').show();
                }
                ); 
         }
    </script>
</head>
<body>
<section id="main-content">   


 <section id="content">
  <div class="centered">
      <div class="grid-1">
           <div class="title-grid"><span>Enquiry</span><span style="float:right;text-decoration:none;"><a href="careers-inner.php?type=add" style="color:#fff !important;">Enquiry Listings</a></span></div>
           <div class="content-gird">
           <div class="alert red hideit" style="display:none;" id="deldiv"><a class="close" onclick ="location.reload();">Close</a></div>
           <?php 
                global $con;
$prod_qry = mysqli_query($con,"select * from signup order by id");
           ?>
                <table class="display" id="example">
                <thead>
                    <tr>
                        <th class="th_chexbox"><input type="checkbox" name="set" onclick="setChecked(this)" /></th>
                        <th class="th_title">Fullname</th>
                        <th class="th_status">Email</th>
                        <th class="th_action">phone </th>
                        <th class="th_action">city </th>
                        <th class="th_action">enquiry </th>
                    </tr>
                </thead>
                <tbody>
                <?php while ($prod = mysqli_fetch_array($prod_qry)) { ?>
                    <tr class="item">
                        <td><input type="checkbox" name="id[]" value="1" /></td>
                        <td class="subject"><a href="careersdetails-inner.php?type=view&id=<?= $prod['id']; ?>"><?= $prod['fullname']; ?></a></td>
                        <td><?= $prod['email']; ?></td>
                        <td><?= $prod['phone']; ?></td>
                        <td><?= $prod['city']; ?></td>
                        <td><a href="../<?= $prod['cvpath']; ?>" target="_blank"><?= $prod['needs']; ?></a></td>

                    </tr>
                    <?php } ?>
                </tbody>
            </table>
            <div class="clear"> </div>
           </div>
           </div>
<!--       Table Ends -->

       </div><!--end center-->  
 </section>  <!--end content-->   
<!-- Form -->
    <div id="deletedialog" title="Upload Images" style="display:none">
        <div id='preview'></div>
                <h1>Delete</h1> 
                                <div>
                                Do you really want To Delete this? This cannot be undone!
                                </div>
                </div>
<!-- Form -->
<div class="empty"></div>
</section>   <!--end main-content-->     


</body>
</html>

Now, the issue is, this code has been coded by previous developer and my client wishes me to handle the project but I am a newbie with PHP forms being integrated in SQL and the mail being sent to the client with details of customers

Futhermore, the clients wishes to integrate this contact form along with some property managements software which uses api and the property management company has given the following information along with code to integrate

Getting Started

  • Web service deployment

Web service name is PostEnquiry It is deployed on server 114.143.217.246:85 from where any application can consume the web service deployed on it.

  • Sample application

http:// 114.143.217.246:85/HighriseAPI/Enquiry_Service.asmx?op=Enquiry_Method

Picture Here

Implementing the web service

Add reference of web service reference in your application. Below is the sample code to consume web service, assuming validation is being done before calling save method of web service. (Please see comments for better understanding)

Dim id As Integer
\* Create Instance of a web service *\
Dim objPostEnquiry As New PostEnquiryToERP.PostEnquiryToERP

\* Create Instance of an Enquiry object *\
       Dim objEnquiry As New PostEnquiryToERP.Enquiry

\* Set properties of an Enquiry object *\
       objEnquiry.EnquiryName = txtName.Text.Trim
       objEnquiry.ContactNo = txtContact.Text.Trim
       objEnquiry.EmailId = txtEmail.Text.Trim
       objEnquiry.Address = txtAddress.Text.Trim 
       objEnquiry.City = txtCity.Text.Trim
       objEnquiry.Zip = txtZip.Text.Trim
       objEnquiry.State = txtState.Text.Trim
       objEnquiry.Country = txtCountry.Text.Trim
       objEnquiry.Remark = txtRemark.Text.Trim
       objEnquiry.EnquiryType = txtEnqType.Text.Trim
       objEnquiry.Project = txtProject.Text.Trim


\* Invoke Save method of web service and pass Enquiry object as an argument*\
       id = objPostEnquiry.InsertEnquiry(objEnquiry)

\* If id>0 then assume that record saved successfully *\

If id > 0 Then
        lblMessage.Text = "Record Saved Successfully"
       End If

On completion of code “objPostEnquiry.InsertEnquiry(objEnquiry)” new enquiry will generate in ERP and return the enquiry number in ERP, else you will get the exception as string.

I have tried all possibilities and searched entire google but found no solutions, please help me with the same

0

There are 0 answers