Jump to content

Page Breaks in a PHP form


Brad420

Recommended Posts

I have created a php form that updates a table and a JavaScript program that scrolls the info from the table. Everything works until I add a break in the data I am adding. Is there something I need to do with the data to have it display correctly?

 

Here is the form http://beta.auctioncms.com/dinardoupdate.php

Here is the output http://beta.auctioncms.com/dinardoframe.php

 

Thanks,

Link to comment
Share on other sites

There is no error...  If you add text with out pressing enter the script works, but as soon as you hit return inside the text area. The 2nd script no longer scrolls the text that you provide in the first form.

 

I will post my code below....

 

This Displays the text in a scrolling box...

 

//----------------- Make the MySQL connection
$_link = mysql_connect($_dbhost, $_dbuser, $_dbpass);
if (!$_link) {
   die('Not connected : ' . mysql_error());
}

// make foo the current db
$_db_selected = mysql_select_db($_dbname, $_link);
if (!$_db_selected) {
   die ('Can\'t use foo : ' . mysql_error());
}

$query  = "SELECT textjs FROM scroll";
$result = mysql_query($query); 
$row = mysql_fetch_array($result); 
?>

<html>
<head>
<style type="text/css">
Body { Background-color: #682282; }</style>

<script language="JavaScript">
<!--//hide script
<!-- This script and many more are available free online at --->
<!-- The JavaScript Source!! http://javascript.internet.com --->

<!--Begin
//scroller width
var swidth=175

//scroller height
var sheight=70

//scroller's speed;
var sspeed=2

var mymessage=''

//text: change to your own

mymessage='<div align="left" style="background-color:#682282;"><font style="color: #FFFFFF; background-color:#682282; font-family:verdana;"><? echo $row['textjs']; ?></font></DIV>'

function start(){
if (document.all) return
if (document.getElementById){
document.getElementById("slider").style.visibility="show"
ns6marquee(document.getElementById('slider'))
}
else if(document.layers){
document.slider1.visibility="show"
ns4marquee(document.slider1.document.slider2)
}
}
function ns4marquee(whichlayer){
ns4layer=eval(whichlayer)
ns4layer.document.write(mymessage)
ns4layer.document.close()
sizeup=ns4layer.document.height
ns4layer.top-=sizeup
ns4slide()
}
function ns4slide(){
if (ns4layer.top>=sizeup*(-1)){
ns4layer.top-=sspeed
setTimeout("ns4slide()",100)
}
else{
ns4layer.top=sheight
ns4slide()
}
}
function ns6marquee(whichdiv){
ns6div=eval(whichdiv)
ns6div.innerHTML=mymessage
ns6div.style.top=sheight
sizeup=sheight
ns6slide()
}
function ns6slide(){
if (parseInt(ns6div.style.top)>=sizeup*(-1)){
ns6div.style.top=parseInt(ns6div.style.top)-sspeed
setTimeout("ns6slide()",100)
}
else{
ns6div.style.top=sheight
ns6slide()
}
}

// End --->

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

//stop hiding script --->
</script>

</head>
<body onLoad="start();" >


<table cellpadding="0" cellspacing="0" border="0" align="left" width="175">
<tr>
<td bgcolor="#682282;">
<span style="background-color:#682282; width:175; height:70;">
<ilayer width=175 height=70 name="slider1" bgcolor="#682282" visibility=hide>
<layer name="slider2" onMouseOver="sspeed=0;" onMouseOut="sspeed=2"></layer>
</ilayer>
<script language="JavaScript">
if (document.all){
document.writeln('<marquee id="ieslider" scrollAmount=2 width=175 height=70 direction=up style="background-color:#682282">')
document.writeln(mymessage)
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=2")
document.write('</marquee>')
}
if (document.getElementById&&!document.all){
document.write('<div style="position:relative;overflow:hidden;width:175;height:70;clip:rect(0 302 102 0);" onMouseover="sspeed=0;" onMouseout="sspeed=2">')
document.write('<div id="slider" style="position:relative;width:&{swidth};">')
document.write('</div></div>')
}
</script>
</span>
</td>
</tr>
</table>

 

 

 

This updates the table which the data is pulled from....

 

//----------------- Make the MySQL connection
$_link = mysql_connect($_dbhost, $_dbuser, $_dbpass);
if (!$_link) {
   die('Not connected : ' . mysql_error());
}

// make foo the current db
$_db_selected = mysql_select_db($_dbname, $_link);
if (!$_db_selected) {
   die ('Can\'t use foo : ' . mysql_error());
}


$value = $_POST['newtext'];
$result = mysql_query("UPDATE scroll SET textjs = '$value' WHERE id = 1"); 


$query  = "SELECT textjs FROM scroll";
$result2 = mysql_query($query); 
$row = mysql_fetch_array($result2); 

?>

<form action="" method="post">
<p>Scrolling Text:</p>
<p><textarea name="newtext" style="width:190px;"><? echo stripslashes($row['textjs']); ?></textarea></p>
<p><input type= "submit" value="Submit"></p>
</form>


 

--fenway: use code tags!

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.