Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1448 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

making a new div

Thread title: making a new div
Closed Thread    
    Thread tools Search this thread Display Modes  
03-19-2007, 07:49 PM
#1
ali.black is offline ali.black
Status: I'm new around here
Join date: Feb 2007
Location:
Expertise:
Software:
 
Posts: 13
iTrader: 0 / 0%
 

ali.black is on a distinguished road

  Old  making a new div

Hey,

i got a question i have a two div tags that layout a content box and a content boxheader. i also have a php script that has a form in it that allows me to fill it in and when i click submit it is displayed where ever i put the second part of the script, so if i put it in the content div it would be displayed in there. this is good but i was wondering if it is possible when i click submit on the form it creates its on divs that display on top of each other.

sorry lol, its not very well explained but hopefully you understand what im getting at.

cheers in advance,

Ali

03-19-2007, 08:17 PM
#2
Amross is offline Amross
Status: Member
Join date: Jan 2007
Location:
Expertise:
Software:
 
Posts: 311
iTrader: 4 / 100%
 

Amross is on a distinguished road

  Old

I am not sure if I fully understand you due to your explanation, however you can output divs the same way you output the rest of the content from your form. So it would be something like:

PHP Code:
echo '<div>Form has been submitted.</div>'

03-19-2007, 08:28 PM
#3
ali.black is offline ali.black
Status: I'm new around here
Join date: Feb 2007
Location:
Expertise:
Software:
 
Posts: 13
iTrader: 0 / 0%
 

ali.black is on a distinguished road

  Old

ohh ye i understand ill give it a go to see if it works

03-19-2007, 08:31 PM
#4
Amross is offline Amross
Status: Member
Join date: Jan 2007
Location:
Expertise:
Software:
 
Posts: 311
iTrader: 4 / 100%
 

Amross is on a distinguished road

  Old

Originally Posted by ali.black View Post
ohh ye i understand ill give it a go to see if it works
Good luck with it.

03-19-2007, 09:30 PM
#5
ali.black is offline ali.black
Status: I'm new around here
Join date: Feb 2007
Location:
Expertise:
Software:
 
Posts: 13
iTrader: 0 / 0%
 

ali.black is on a distinguished road

  Old

here is the php to display the info posted.

PHP Code:
<?php
include ('mysql_connect.php');
$query "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts";
$result = @mysql_query($query);
 
if (
$result) {
while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
$url 'comments.php?id='.$row['id'];
echo 
'<p><b>'.$row['title'].'</b><br><br>
'
<div id="mtext">.$row['post'].</div>'<br><br>
Posted by : <b>'
.$row['author'];
}
} else {
echo 
'There are no news posts to display';
}
?>

here is the content box div <div class="mtext"> and the header is <div class="mheader">

so basically i want the 'title' to be displayed in the <div class="mheader"> and the 'post' and 'author' to be displayed in the mtext div. but when i click submit on the form i want these .$row['title'] and .$row['post'] to create its own mheader and mtext itself so that i dont have to make these divs on the news page and then put the php code above in the right divs. hope this made better sense.

03-19-2007, 09:35 PM
#6
Amross is offline Amross
Status: Member
Join date: Jan 2007
Location:
Expertise:
Software:
 
Posts: 311
iTrader: 4 / 100%
 

Amross is on a distinguished road

  Old

Well at first glance without really dissecting your code, you have things outside quotes which should be inside them. For example <div id="mtext"> and the closing div tag for that should be inside the quotes, not outside them.

03-21-2007, 11:55 PM
#7
VincePirez is offline VincePirez
Status: Sin Binner
Join date: Mar 2007
Location:
Expertise:
Software:
 
Posts: 19
iTrader: 0 / 0%
 

VincePirez is on a distinguished road

  Old

[QUOTE=ali.black;320182]here is the php to display the info posted.

PHP Code:
<?php
include ('mysql_connect.php');
$query "SELECT id, title, author, post, DATE_FORMAT(date, '%M %d, %Y') as sd FROM news_posts";
$result = @mysql_query($query);
 
if (
$result) {
while (
$row mysql_fetch_array($resultMYSQL_ASSOC)) {
$url 'comments.php?id='.$row['id'];
echo 
'<p><b>'.$row['title'].'</b><br><br>
'
<div id="mtext">.$row['post'].</div>'<br><br>
Posted by : <b>'
.$row['author'];
}
} else {
echo 
'There are no news posts to display';
}
?>
First off, your PHP is incorrect. The if($result) part merely checks that the MySQL query executed without any problems. It DOES NOT tell you if there are any new rows. You will need to use mysql_num_rows to check for this, for example:

PHP Code:
if (mysql_num_rows($result) > 0) { /* Do something */ 
Secondly, unfortunately I don't really understand your question.....

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed