Ok made a few changes again, and I'm able to save the xml file now, but its permanent. At least thats a start, the form input below has been chaged but still doesn't
write to the xml file. I understand why it opens in a new tab in IE9 and thats better than losing the video player page to a blank page.
HTML Code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var fieldCount = 1;
function addVideo() {
fieldCount++;
var newVideo = document.createElement('input');
newVideo.type = 'text';
newVideo.name = 'file' + fieldCount; //Changed video to file here
newVideo.id = 'file' + fieldCount; //Changed video to file here also
document.getElementById('fs').appendChild(newVideo);
}
</script>
<style type="text/css">
input {
display: block;
margin-bottom: 2px;
}
button {
float: right;
}
fieldset {
border: 2px solid blue;
}
#h1 {
color: #00F;
}
#p {
font-size: 20px;
}
</style>
</head>
<body>
<style1><span id="h1">Add Videos</span></style1>
<br>
<br>
<form action="createplaylist.php" method="post" target="_new" enctype="multipart/form-data"> //This is better than losing the video player page to a blank page but its unwanted
<p>
<label for="video" id="p">Video name</label>
<input type="text" name="file" id="file"> //Changed video to file here as well
<fieldset id="fs">
<legend id="p">Other videos you wish to add</legend></p>
<button onclick="addVideo(); return false;">
Add another video
</button>
<input type="text" name="file1" id="file1" max="250"> //Changed video1 to file1 here
</fieldset>
<input type="submit" value="Save details">
</form>
</body>
</html>
This is the PHP I've now changed to the comments should be fairly self explanitary, and at least it saves the XML file to the right place, even if it's
not filling it in.
PHP Code:
<?php
$xmlfile = "wrmvlplayer.xml";
$file = fopen($xmlfile,"w");
fwrite($file, "<videolist>"."\n");
fwrite($file, "<video>"."\n");
//This is the first form input field, videos/ is the video file directory
fwrite($file, "<file>videos/</file>"."\n"); //The form input field needs to insert the file name after videos/ (remaining blank ATM)
fwrite($file, "<image>videos/websitetitled.jpg</image>"."\n"); //This should be good and doesn't need to change
fwrite($file, "<title></title>"."\n"); //The form input field needs to insert the same file name between the two <title></title> tags
fwrite($file, "<description></description>"."\n"); //The form input field needs to insert the same file name between the two <description></description> tags
fwrite($file, "</video>"."\n");
// This is the second form input field, and is similar to the first form input with the exception of having a different file name
fwrite($file, "<video>"."\n");
fwrite($file, "<file1>videos/</file1>"."\n");
fwrite($file, "<image>videos/websitetitled.jpg</image>"."\n");
fwrite($file, "<title></title>"."\n");
fwrite($file, "<description></description>"."\n");
fwrite($file, "</video>"."\n");
// This is the third form input field, and is similar to the above two but also having a different file name. This pattern needs to continue for as many videos as the user wishes to input
// with a MAX = 250
fwrite($file, "<video>"."\n");
fwrite($file, "<file2>videos/</file2>"."\n");
fwrite($file, "<image>videos/websitetitled.jpg</image>"."\n");
fwrite($file, "<title></title>"."\n");
fwrite($file, "<description></description>"."\n");
fwrite($file, "</video>"."\n");
fwrite($file, "</videolist>"."\n");
fclose($file);
?>
And this is the saved XML file, though it doesn't show the XML version or encodings as well as no fomating, big deal! It's an improvement.
Code xml:
<videolist>
<video>
<file>videos/</file>
<image>videos/websitetitled.jpg</image>
<title></title>
<description></description>
</video>
<video>
<file1>videos/</file1>
<image>videos/websitetitled.jpg</image>
<title></title>
<description></description>
</video>
<video>
<file2>videos/</file2>
<image>videos/websitetitled.jpg</image>
<title></title>
<description></description>
</video>
</videolist>
So a little progress has been made thus far
Bookmarks