Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-22-2006, 01:42 PM   #11 (permalink)
penguinsrule
Junior Member
 
Join Date: Aug 2006
Posts: 19
Default Re: PHP form for entering data to MySQL database

bo i mean why you fill the form in it has a multi line text box and you type it in and hit enter for a new line and send it and when you call the data up again it is how the user saved it

Last edited by penguinsrule : 08-22-2006 at 02:25 PM.
penguinsrule is offline   Reply With Quote
Sponsored Links
Old 08-22-2006, 08:09 PM   #12 (permalink)
O~Snapple
Moderator Of The Year
 
O~Snapple's Avatar
 
Join Date: Jul 2006
Location: Cali Breeze
Posts: 716
Send a message via MSN to O~Snapple Send a message via Skype™ to O~Snapple
Default Re: PHP form for entering data to MySQL database

Fair enough let the record show " If your going to use PHP at all on your site its easier to to use all the Extension PHP's"
__________________
The Real Truth
Epademik Emcee Esq. New Album The 3rd Finger is in Stores Now!
Snap Marketing Management and Consulting
O~Snapple is offline   Reply With Quote
Old 08-22-2006, 08:20 PM   #13 (permalink)
penguinsrule
Junior Member
 
Join Date: Aug 2006
Posts: 19
Default Re: PHP form for entering data to MySQL database

Any body got a solution to my problem.
when you enter the data into a form you type a bit hit enter do i bit more and when you hit enter can you tell it to add in <br> or somthing to start a new paragrph so when it comes to showing it isnt one big block.
penguinsrule is offline   Reply With Quote
Old 08-22-2006, 10:55 PM   #14 (permalink)
No0oB
Junior Member
 
Join Date: May 2006
Location: Near Frankfurt
Posts: 26
Send a message via ICQ to No0oB Send a message via MSN to No0oB
Default Re: PHP form for entering data to MySQL database

Quote:
Originally Posted by No0oB
Theres an easy function in PHP called nl2br()
So basically, when you call $row['notes'] (or whatever your variable for the MySQL output is) you use the function to do so
PHP Code:
echo nl2br($row['notes']); 

I have recently posted this in this thread
__________________
No0oB
Cafe Vienna
Cafe Heidelberg
No0oB is offline   Reply With Quote
Old 08-22-2006, 11:00 PM   #15 (permalink)
penguinsrule
Junior Member
 
Join Date: Aug 2006
Posts: 19
Default Re: PHP form for entering data to MySQL database

yeah i know but it selects all the rows of that field and displays them one below the other what i dont want i want one row to do that.

entered in forum
#cheat hello
rfuihriuvbriuvbr;
rviubruivbrvruibv;
ribvruibvrivbrvb;

Comes out like
#cheat hello rfuihriuvbriuvbr; rviubruivbrvruibv; ribvruibvrivbrvb;

I want it like the orginal any ideas please
penguinsrule is offline   Reply With Quote
Old 08-22-2006, 11:01 PM   #16 (permalink)
No0oB
Junior Member
 
Join Date: May 2006
Location: Near Frankfurt
Posts: 26
Send a message via ICQ to No0oB Send a message via MSN to No0oB
Default Re: PHP form for entering data to MySQL database

But the nl2br() turns all the newlines (\n) into <br> for HTML :/
__________________
No0oB
Cafe Vienna
Cafe Heidelberg
No0oB is offline   Reply With Quote
Old 08-22-2006, 11:04 PM   #17 (permalink)
penguinsrule
Junior Member
 
Join Date: Aug 2006
Posts: 19
Default Re: PHP form for entering data to MySQL database

cool how you use it this is what my show thing looks like

PHP Code:
<script language="javascript" type="text/javascript">

  function showCheat(CheatID) {

     var codeDIV = document.getElementById("cheat_" + CheatID);
     var linkDIV = document.getElementById("cheat_" + CheatID + "_show");

     if (codeDIV.style.display == "block") {

        linkDIV.childNodes[0].nodeValue = "View Cheat";
        codeDIV.style.display = "none";

     } else {

        linkDIV.childNodes[0].nodeValue = "Hide Cheat";
        codeDIV.style.display = "block";

     }

  }
</script>
<SCRIPT LANGUAGE="JavaScript">



<!-- Begin
var win = null;
function newWindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
//  End -->
</script>
<style type="text/css">
<!--
body,td,th {
    color: #006699;
}
a {
    font-size: 12px;
}
a:link {
    color: #006699;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #006699;
}
a:hover {
    text-decoration: underline;
    color: #006699;
}
a:active {
    text-decoration: none;
    color: #006699;
}
.style2 {font-size: 12px}
.style4 {font-size: 10px; }
.style6 {color: #006699}
.style8 {font-size: 12px; color: #cccccc; }
body {
    background-color: #CCCCCC;
}
-->
</style>
<?

echo "<b>Environment Codes</b><br><br><br>";
include 
"config.php";


$query "SELECT * FROM environment ORDER BY cheat_id DESC"
$result=mysql_query($query) or die (mysql_error());
$aantal mysql_num_rows($result);

if (
$aantal==0) {
echo 
"There are no Cheats.";
}else{


while (
$sql mysql_fetch_assoc($result)) {
 
echo 
"<table width=618 border=0 cellpadding=0 cellspacing=3><tr><td width=15><img src=pictures/ok.PNG width=15 height=15 align=middle /></td><td width=30><a href=#null onclick=newWindow('".$sql['pic']."','','500','300')><img src=pictures/camera.PNG width=30 height=23 border=0 /></a></td><td colspan=5><strong>Title:</strong> ".$sql['cheat_name']."</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td colspan=5><span class=style2><strong>Description:</strong>".$sql['cheat_des']."</span></td></tr><tr><td height=19>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan=5><div id=cheat_"
.$sql['cheat_id']." class=cheatlist_code style=display:none;>
"
nl2br($row['cheat'])"
  </div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td width=154><span class=style2><strong>Submitted:</strong>"
.$sql['date']."</span></td>
    <td width=60><span class=style8><strong>Size: 8.00kb</strong></span></td>
    <td width=200><span class=style2><strong>Author:</strong> "
.$sql['author']."</span></td>
    <td><div align=right>
      <iframe src=countd.php?file=telstadv1 align=right width=20 marginwidth=0 height=20 marginheight=0 scrolling=No frameborder=0 class=style6></iframe>
    </div></td>
    <td><a href=dntelstadv1.php><img src=pictures/download.gif width=75 height=15 border=0 align=right /></a></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan=2>&nbsp;</td>
    <td width=60> <td align=right><a href=javascript:showCheat('"
.$sql['cheat_id']."'); id=cheat_".$sql['cheat_id']."_show>View Cheat</a>
 
  
</div></td>
  </tr>
  <tr>
    <td height=19 colspan=7><hr></td>
  </tr>
</table>"
;


}
}
?>

Last edited by penguinsrule : 08-22-2006 at 11:16 PM.
penguinsrule is offline   Reply With Quote
Old 08-23-2006, 02:29 PM   #18 (permalink)
No0oB
Junior Member
 
Join Date: May 2006
Location: Near Frankfurt
Posts: 26
Send a message via ICQ to No0oB Send a message via MSN to No0oB
Default Re: PHP form for entering data to MySQL database

PHP Code:
<?

echo "<b>Environment Codes</b><br><br><br>";
include 
"config.php";


$query "SELECT * FROM environment ORDER BY cheat_id DESC"
$result=mysql_query($query) or die (mysql_error());
$aantal mysql_num_rows($result);

if (
$aantal==0) {
echo 
"There are no Cheats.";
}else{


while (
$sql mysql_fetch_assoc($result)) {
 
echo 
"<table width=618 border=0 cellpadding=0 cellspacing=3><tr><td width=15><img src=pictures/ok.PNG width=15 height=15 align=middle /></td><td width=30><a href=#null onclick=newWindow('".$sql['pic']."','','500','300')><img src=pictures/camera.PNG width=30 height=23 border=0 /></a></td><td colspan=5><strong>Title:</strong> ".$sql['cheat_name']."</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td colspan=5><span class=style2><strong>Description:</strong>".$sql['cheat_des']."</span></td></tr><tr><td height=19>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan=5><div id=cheat_"
.$sql['cheat_id']." class=cheatlist_code style=display:none;>
"
.nl2br($sql['cheat'])."
  </div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td width=154><span class=style2><strong>Submitted:</strong>"
.$sql['date']."</span></td>
    <td width=60><span class=style8><strong>Size: 8.00kb</strong></span></td>
    <td width=200><span class=style2><strong>Author:</strong> "
.$sql['author']."</span></td>
    <td><div align=right>
      <iframe src=countd.php?file=telstadv1 align=right width=20 marginwidth=0 height=20 marginheight=0 scrolling=No frameborder=0 class=style6></iframe>
    </div></td>
    <td><a href=dntelstadv1.php><img src=pictures/download.gif width=75 height=15 border=0 align=right /></a></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan=2>&nbsp;</td>
    <td width=60> <td align=right><a href=javascript:showCheat('"
.$sql['cheat_id']."'); id=cheat_".$sql['cheat_id']."_show>View Cheat</a>
 
  
</div></td>
  </tr>
  <tr>
    <td height=19 colspan=7><hr></td>
  </tr>
</table>"
;


}
}
?>

You don't have a variable called $row, therefore it is stupid to use my example word by word
Your variable for fetching the MySQL Data is $sql, so you use that instead.
Also, you should have a look at escaping, as you didnt escape nl2br()!

Another thing is that your HTML Code is not valid at all. You forget the " at every attribute
__________________
No0oB
Cafe Vienna
Cafe Heidelberg
No0oB is offline   Reply With Quote
Old 08-23-2006, 02:39 PM   #19 (permalink)
penguinsrule
Junior Member
 
Join Date: Aug 2006
Posts: 19
Default Re: PHP form for entering data to MySQL database

oh i have no other idear to do it how i want, but can you put it the nl2br($row['cheat']) hing in so it works please
penguinsrule is offline   Reply With Quote
Old 08-23-2006, 02:49 PM   #20 (permalink)
No0oB
Junior Member
 
Join Date: May 2006
Location: Near Frankfurt
Posts: 26
Send a message via ICQ to No0oB Send a message via MSN to No0oB
Default Re: PHP form for entering data to MySQL database

I think I already fixed it, as I escaped the function and changed $row['cheat'] to $sql['cheat']
Have you tried copying my code?
__________________
No0oB
Cafe Vienna
Cafe Heidelberg
No0oB is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display mysql table fields and data goldfish PHP Development 6 05-14-2008 04:49 AM
Build a web database without any programming experience required xacto Advertise or Request 0 06-29-2005 09:25 PM
Listing mysql data using php kayla Other Programming - Perl, C++, Java, ASP, .NET Development 1 06-26-2005 10:07 PM


» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 06:57 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums