getting checkbox values into an xml file using php
Hi, I am very new to PHP.
songs.html contains a form where I have to select one or more check boxes.
(playlist.xml)
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<track>
<path>song.mp3</path>
<title>Track 1 - Track Title</title>
</track>
<track>
<path>song.mp3</path>
<title>Track 2 - Track Title</title>
</track>
<track>
<path>song.mp3</path>
<title>Track 3 - Track Title</title>
</track>
<track>
<path>song.mp3</path>
<title>Track 4 - Track Title</title>
</track>
<track>
<path>song.mp3</path>
<title>Track 5 - Track Title</title>
</track>
<track>
<path>song.mp3</path>
<title>Track 6 - Track Title</title>
</track>
</xml>
(embedded code for my player)
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashPlayer">
This text will be replaced by the flash music player.
</div>
<script type="text/javascript">
var so = new SWFObject("playerMultipleList.swf", "mymovie", "295", "200", "7", "#FFFFFF");
so.addVariable("autoPlay","no")
so.addVariable("playlistPath","playlist.xml")
so.write("flashPlayer");
</script>
My aim is that when I open songs.html it will contain a form with checkboxes to select songs.
After selecting checkboxes, the values should be inserted into the playlist.xml file.
<path>**song.mp3**</path>
<title>**Track 3 - Track Title**</title>
The path and title values should be changed dynamically when I select any checkbox.
Please give me the code for songs.html, playlist.xml and tell me how to open the embedded flash player in a new window.
getting checkbox values into an xml file using php dynamical
Moderator: General Moderators
-
gadadasusrikanth
- Forum Newbie
- Posts: 10
- Joined: Mon Jan 12, 2009 11:26 pm
Re: getting checkbox values into an xml file using php dynamical
We frown on requests like that. We'll help you, yeah, but you probably won't find somebody who will do it for you.gadadasusrikanth wrote:Please give me the code for songs.html, playlist.xml and tell me how to open the embedded flash player in a new window.
The HTML file should be easy for you: just make a form with checkboxes. Then you make a PHP file (where the form is pointed towards) that takes all the info from the checkboxes and saves it into your XML file.
You'd use the $_POST superglobal, the fopen, fwrite, and fclose functions, and... actually, that's all you'll need.
-
gadadasusrikanth
- Forum Newbie
- Posts: 10
- Joined: Mon Jan 12, 2009 11:26 pm
Re: getting checkbox values into an xml file using php dynamical
my songs.html page look like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="player.php" name="myForm" >
<p>
<input type="checkbox" name="song" title="song1" value="song1.mp3" />song1 <br>
<input type="checkbox" name="song" title="song2" value="song2.mp3" />song2 <br>
<input type="checkbox" name="song" title="song3" value="song3.mp3" />song3 <br>
<input type="checkbox" name="song" title="song4" value="song4.mp3" />song4 <br>
<input type="checkbox" name="song" title="song5" value="song5.mp3" />song5 <br>
</p>
<br />
<input type="submit" value="play" />
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="player.php" name="myForm" >
<p>
<input type="checkbox" name="song" title="song1" value="song1.mp3" />song1 <br>
<input type="checkbox" name="song" title="song2" value="song2.mp3" />song2 <br>
<input type="checkbox" name="song" title="song3" value="song3.mp3" />song3 <br>
<input type="checkbox" name="song" title="song4" value="song4.mp3" />song4 <br>
<input type="checkbox" name="song" title="song5" value="song5.mp3" />song5 <br>
</p>
<br />
<input type="submit" value="play" />
</form>
</body>
</html>