I need help in coding a PHP contact form. My goal is to take the data from the Contact form (Name, Summary, Details, Due Date, Check boxes, etc) and merge this data into an existing text file. This text file will have existing text that cannot be overwritten. Hopefully I can just take the variables from the contact form and replace them into the existing text file.
Existing PHP Contact Form data-
[php]<?php
$action = $_GET[“action”];
$myText = $_POST[“loginid”].$_POST[“summary”].$_POST[“details”].$_POST[“ddate”].$_POST[“application”];
if($action = “save”) {
$targetFolder = “C:\Apach2\htdocs\wp1a”;
file_put_contents($targetFolder.“mytext.txt”, $myText);
}
?>
Summary:
Details:
Due Date:
MS Word MS Excel MS PowerPoint
[/php] ===============================================
Here is the existing mytext.txt with Variables. These variables will be merged from the Contact form-
===============================================
[php]{
“fields”: {
“project”:
{
“id”: “11900”
},
“summary”: $_POST[“summary”],
“duedate”: $_POST[“ddate”],
“issuetype”: {
“id”: “20”
},
“customfield_12900”:“11182”,
“customfield_11000” : {“name”:“HelpDesk”},
“customfield_11600”: {“value”:“System” },
“customfield_11801”: {“value”:“Request” },
“customfield_11100”: {“value”:“AD/LDAP” },
“customfield_11102”: {“name”:$_POST[“loginid”] },
“customfield_11100”: {“value”:$_POST[“application”] }
}
}[/php]
So the Variables ($_POST[“loginid”].$_POST[“summary”].$_POST[“details”].$_POST[“ddate”].$_POST[“application”]) will need to be merged into the existing file mytext.txt.
Thanks in advance,