0

I've been trying to create a form to create known issues for our tech support group for RSS feed however it does not seem to be creating the XML.

I've tried to keep it as simple as possible but I may have kept it too simple and overlooked something.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
</head>
<body>
<form name="form1" action="generate.php" method="post">

Name of Issue: <input name="name" type="text" /><br/><br/>
Core Service(s): <input name="service" type="text" /><br/><br/>
Severity:<br>
<form>
<input type="radio" name="severity" value="Sev1">Sev1<br>
<input type="radio" name="severity" value="Sev2">Sev2<br>
<input type="radio" name="severity" value="Sev3">Sev3<br>
</form> <BR/> <br/>
Team Looking into Issue: <input name="Team" type="text" /> <BR/> <br/>
ETA (if known): <input name="ETA" type="text" /> <BR/> <br/>
Comments: <textarea name="comments" cols="50" rows="5">

</textarea><br/><br/>
<input type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>

Backend generate.php

<?php

 if(isset($_POST['create_issue'])){

        echo "Issue Posted";

        $xmlfileName = "issues.xml"

        $name = $_POST['name'];

        $service = $_POST['service'];

        $severity = $_POST['severity'];

        $Team = $_POST['service'];

        $ETA = $_POST['ETA'];

        $comments = $_POST['comments'];

        $xml_dec = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";

/* After Receiving data for issue created generate XML*/

        $rootELementStart = "<knownissue>";

        $rootElementEnd = "</knownissue>";

        $xml_doc=  $xml_dec;

        $xml_doc .=  $rootELementStart;

        $xml_doc .=  "<name>";

        $xml_doc .=  $name;

        $xml_doc .=  "</name>";

        $xml_doc .=  "<service>";

        $xml_doc .=  $service;

        $xml_doc .=  "</service>";

        $xml_doc .=  "<severity>";

        $xml_doc .=  $severity;

        $xml_doc .=  "</severity>";

        $xml_doc .=  "<team>";

        $xml_doc .=  $team;

        $xml_doc .=  "</team>";

        $xml_doc .=  "<eta>";

        $xml_doc .=  $ETA;

        $xml_doc .=  "</eta>";

        $xml_doc .=  "<comments>";

        $xml_doc .=  $comments;

        $xml_doc .=  "</comments>";

        $xml_doc .=  $rootElementEnd;

        $default_dir = "";

        $default_dir .=   $xmlfileName .".xml";

/* Write XML */

$fp = fopen($default_dir,'w');

            $write = fwrite($fp,$xml_doc);
            }
?>
2
  • is anything at all created? or nothing? Are you sure your script has write permissions there? Commented Oct 14, 2014 at 19:59
  • Script has full permissions and nothing is created at all. Also the Echo is not appearing as I added that to help me know that it was working or not. Commented Oct 14, 2014 at 20:14

1 Answer 1

1

This line is missing a semicolon:

$xmlfileName = "issues.xml"

Dont forget to fclose your file too! You can get some useful error information that way.

Sign up to request clarification or add additional context in comments.

2 Comments

Aw man I can't believe I didn't see that... and yes I will add fclose. It is still not appearing to work however. It maybe something with the frontend backend that isn't working is my worry now.
@Ericrs - this looks to answer the question...if it doesn't you should elaborate, if it does, you should check it as correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.