Jump to content

Break gone wild


ecabrera

Recommended Posts

why is it that when i saved it adds a break tag i dont understhand heres the code i cant find it its only when i save or remove a video and save it it has a break

 

<?php

require "scripts/connect.php";

if($_POST['submitbtn']){

$video1 = mysql_real_escape_string(html_entity_decode($_POST['video1']));
$video2 = mysql_real_escape_string(html_entity_decode($_POST['video2']));
$video3 = mysql_real_escape_string(html_entity_decode($_POST['video3']));
$video4 = mysql_real_escape_string(html_entity_decode($_POST['video4']));

if($video1){
if($video2){
if($video3){
if($video4){

$query = mysql_query("UPDATE videos SET video1='$video1',video2='$video2',video3='$video3',video4='$video4'");

header("location: http://www.mywebsite.com/admin/editvideos");

}else
$msg = "PLEASE FILL IN";
}else
$msg = "PLEASE FILL IN";
}else
$msg = "PLEASE FILL IN";
}else
$msg = "PLEASE FILL IN";
}
mysql_close();
?>
<?php include "header.php";?>
<?php if($email){?>

<?php include "inc/nav.php"; ?>

<div id="righthomecontent">

<?php
require "scripts/connect.php";

$query = mysql_query("SELECT * FROM videos");
$rows = mysql_fetch_assoc($query);

$video1 = stripslashes($rows['video1']);
$video2 = stripslashes($rows['video2']);
$video3 = stripslashes($rows['video3']);
$video4 = stripslashes($rows['video4']);

mysql_close();
?>
<center>MUST USE THIS IN VIDEOS ?wmode=opaque"</center><br>
<center>All videos are Width='220' and Height='240'</center><br>

<form class="editvideoform" action="editvideos" method="post">
<table>
<tr>
<td></td>
<td><?php echo $msg;?></td>
</tr>
<tr>
<td>VIDEO 1</td>
<td><textarea cols=25 rows=10 name="video1"><?php echo $video1;?></textarea></td>
</tr>
<tr>
<td>VIDEO 2</td>
<td><textarea cols=25 rows=10 name="video2"><?php echo $video2;?></textarea></td>
</tr>
<tr>
<td>VIDEO 3</td>
<td><textarea cols=25 rows=10 name="video3"><?php echo $video3;?></textarea></td>
</tr>
<tr>
<td>VIDEO 4</td>
<td><textarea cols=25 rows=10 name="video4"><?php echo $video4;?></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submitbtn" value="SUBMIT" /></td>
</tr>
</table>
</form>

</div>
<?php } else 
{
echo "<center><h1>PLEASE LOGIN</h1></center>";
}
?>
<?php include "footer.php";?>

Link to comment
Share on other sites

Since the code you posted won't execute the UPDATE query when you leave any of the textarea's empty, either the <br> in the database table is there from your original INSERT query or you have some code you haven't posted, such as a WYSIWYG javascript editor on the page.

Link to comment
Share on other sites

That editor, probably as a workaround instead of fixing a problem, inserts a <br /> in each empty textarea, that posts as a <br> (I'm not sure where/how the space and / are removed.) If you don't enter anything in a textarea, a <br> is posted. If you do enter something, there is a <br> on the end of it.

 

You would need to check if the posted data from each field is just a <br> and remove it. If you don't want a <br> on the end of each actual value you do enter, you would need to strip that off as well.

 

Didn't it occur to you to mention or show up front that you had some code like a WYSIWYG (and which one) involved? You could have gotten an answer almost 4 days ago.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.