我一直在尝试创建一个表单来为我们的RSS feed技术支持小组创建已知问题,但它似乎并没有创建XML。
我试图让它尽可能简单,但我可能会让它过于简单而忽略了一些东西。
<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>
后端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);
}
?>