I cannot seem to figure this out. I’m trying to get row value from results, and if there is a entry in the DB for video and it’s not null, display a link that says Edit Video Link with a href= of edit_media.php?video=edit (which is this page). If the user clicks this link, the page reloads with the URL including video=edit and that triggers the variable videoEdit to be TRUE which should display a form input box that displays the current value in the database.
However, It doesn’t seem to be working, for some reason I’m seeing the form input box even before I click Edit Video link, (url does not have video=edit). and when I click “Modify Video Link” and the url does have the video=edit, I see a textbox with the words Video in it. I’m not sure why. I have the correct MYSQL Query before this code, but I didn’t include it here. How can I get this working?
// if the user clicked edit video link
if ($_GET['video'] = EDIT) {
$videoEdit = TRUE
}
while ($row = mysql_fetch_array($result, mysql_assoc)) {
$video = $row['video'];
}
if ($videoEdit = TRUE) {
echo '<form action="edit_media.php" method="post">
<p>Video Link: <input type="text" name="serial" size="25" maxlength="100" value=';
if (isset($video))
echo $video;
' /></p><p><input type="submit" name="submit" value="Submit Video" /></p> <input type="hidden" name="submitted" value="TRUE" />
</form>';
}
And it goes on to say:
if ($video != "") {
echo '<iframe width="420" height="315" src=' . $video . ' frameborder="0" allowfullscreen></iframe> | <a href=edit_media.php?video=EDIT>Modify Video Link</a>';
} else {
echo "Video Not Present | <a href=edit_media.php?video=EDIT>Add a Video</a>";
}
Can you help me in making this script work>?
First you’re need a comparisons, not assignments:
and
Also the printing of your video needs to be cleaned up: