I'm trying to write songs to a text file and then be able to add/delete, shuffle etc within that text file.
I'm having an issue with ending my first "IF" statement. Here is what I get they way it is currently written --
You are viewing this page because you have submitted a song to our list
You have not entered a song, please use link below and enter a song
"; die (); } has been added to Duff'sSong list!
You have add a song.
To go back to the main menu Click Here
Here is my HTML front end --
HTML Code:
<html><title> Welcome to Duff's Songs Inventory </title><h1></center><head> Congrats, now that you are here you are able to add songs to your inventory list! </head></center></h1><body><center><form action = "m5donovanCP7-2.php" method = "post"><p><a href="m5donovanCP7-2.php">View List</a><a href = "m5donovanCP7-2.php">Sort By Name</a><a href = "m5donovanCP7-2.php">Shuffle Songs</a><br /><br /><input type = "text" name = "song" size = "25"><input type = "submit" value = "Add Song"></form></center></body></html>
Here is the PHP code: This has the area that should be accepting the new song and writing it to the text file, which it currently isn't doing
PHP Code:
<html>
<title> Welcome to Duff's Songs Inventory </title>
<h2><center><head> You are viewing this page because you have submitted a song to our list</head></center></h2>
<body>
<?php
if (empty($_REQUEST['song']) {
print "<p>You have not entered a song, please use link below and enter a song</p>";
die ();
}
<?php print ("{$_REQUEST['song']}"); ?> has been added to Duff'sSong list!
Okay, i'm still having problems. It isn't quitting out of the "IF" statement and continues on with the code.
Also, I'm trying to have these songs that are added to a text file. I have created another program and usd text files just fine, however this one is giving me some major problems. Would someone look over the syntax to make sure it is correct. I've reviewed but can't find anything
Here is what it gives me if I submit a song or just click on add song button:
You are viewing this page because you have submitted a song to our list You have not entered a song, please use link below and enter a song
"; exit; } ?> has been added to Duff'sSong list!
To go back to the main menu Click Here
Here is the "new" PHP Code:
PHP Code:
<html>
<title> Welcome to Duff's Songs Inventory </title>
<h2><center><head> You are viewing this page because you have submitted a song to our list</head></center></h2>
<body>
<?php
if(!isset($_REQUEST['title'])
|| empty($_REQUEST['title']))
{
print "<p>You have not entered a song, please use link below and enter a song</p>";
exit;
}
?>
<?php print ("{$_REQUEST['title']}"); ?> has been added to Duff'sSong list!
Bookmarks