/    Sign up×
Community /Pin to ProfileBookmark

Urgent ( and simple ) help needed !!!

Hello !!!
I’m launching my website in a few hours, and I just noticed something very annoying, that I don’t know how to fix…
It’s surely something extremely easy, but I’m in a lot of stress and panic right now, so I can’t think properly.

Here is my problem, I have this php script that I wrote from a tutorial, and when I click the submit button, it opens a new page, whereas I want it to open in the same page ( target=_top)
I’m sure it’s easy.

[code=php]
<? include’cookiecheck.php’; ?>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Les Enfants de l’&Ocirc; – Tagboard</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<? include($headervar.$skin.$extension); ?>
<div id=”tag”></div>

<div align=”center” id=”tagboard” class=”border padding”>
<?php

// SQL database Variables
$hostname=”sql.free.fr”;
$user=”myusername”;
$pass=”mypasswd”;
$dbase=”enfantsdelo”;
$connection = mysql_connect(“$hostname” , “$user” , “$pass”);
$db = mysql_select_db($dbase , $connection);

// query database to list the records

$q = “select * from shoutbox order by id desc limit 35 “;
$result = mysql_query($q);

while ($row = mysql_fetch_array($result))
{
$id = $row[“id”];
$name=$row[“name”];
$url = $row[“url”];
$msg = $row[“msg”];
$olddate= $row[“date”];

//put the date in french format
$newdate = date(“d-m-Y”,strtotime($olddate));
$heure = date (“H:i”, strtotime($olddate));

// format how you want the shout box to display the entries here.
if ( $url == ” || $url == ‘http://’ )
{
echo “<p class=”small nflb”><b>$name</b>: $msg<br><em>[$newdate ($heure)]</em></p>”;
}

else
{
echo “<p class=”small nflb”><b><a href=”$url” target=”new”>$name</a></b>: $msg<br><em>[$newdate ($heure)]</em></p>”;
}
}
?>
</div>

<form action=”chat/post.php” method=”post” target=”tagboard”>
<table width=”100%” border=”0″>
<tr>
<td><div align=”center”>Nom :<br>
<input type=”text” name=”name” class=”form small”></div></td>
<td><div align=”center”>URL :<br>
<input type=”text” name=”url” value=”http://” class=”form small”></div></td>
</tr>
<tr>
<td colspan=”2″><div align=”center”>Message :<br>
<textarea cols=”47″ rows=”3″ name=”msg” class=”form small”></textarea></div></td>
</tr>
</table>
<div align=”center”><input type=”submit” class=”submit” value=”Go go go !”></div>
</form>

<? include(‘tag.php’);
include(‘footer.php’);?>
[/code]

that’s the tagboard page. And here comes the post.php file :

[code=php]
<?php

// SQL database Variables
$hostname=”sql.free.fr”;
$user=”myusername”;
$pass=”mypasswd”;
$dbase=”enfantsdelo”;
$connection = mysql_connect(“$hostname” , “$user” , “$pass”);
$db = mysql_select_db($dbase , $connection);

// do a basic check, don’t let user submit a blank entry.

if ($name == ” || $msg == ” )
{
include(‘../msg.php’);
echo “On n’a pas oubli&eacute; quelque chose, par hasard ? Cliquez sur le bouton retour pour ne pas perdre les informations d&eacute;j&agrave; inscrites.”;
include(‘../bottomf.php’);
die;

}

// strips off weird characters and HTML tags

$name = htmlspecialchars($name);
$msg = htmlspecialchars($msg);

// do check here

$last_entry = “select * from shoutbox order by id desc limit 1”;
$check = mysql_query($last_entry);

while ($row = mysql_fetch_array($check))
{
$oldname = $row[“name”];
$oldmsg = $row[“msg”];
}

// compare the values of old and new entry
if ($oldname == $name && $oldmsg == $msg) // means the name and msg entered is the same
{
include(‘../msg.php’);
echo “Bon, je peux comprendre qu’on soit enthousiaste, mais tout de m&ecirc;me, il y a des limites… Cliquez sur le bouton retour pour ne pas perdre les informations d&eacute;j&agrave; inscrites.”;
include(‘../bottomf.php’);
die;
}

// insert into database

$q = “insert into shoutbox (id,name,msg,url,date) VALUES (”,’$name’,’$msg’,’$url’,now()) “;
$result = mysql_query($q);

if ($result)
{
// success so redirect user to view shoutbox.
$siteurl = ‘../chat.php’;
header(‘Location: ‘.$siteurl); // this is probably what has to be changed, if I guess right.
}

?>
[/code]

thanks for all the help !!!

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@pyroJul 13.2005 — Remove target="tagboard" from your <form> tag.
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 13.2005 — Pyro, can I kiss you ?

Thanks a lot !!!

I thought it could be it, but I was very unsure, because I wanted the text to be displayed in this very div...

That's the problem when you're doing several things at the same time. You can't really follow a line of thoughts...

You saved my life !!! ?
Copy linkTweet thisAlerts:
@pyroJul 13.2005 — Pyro, can I kiss you ?[/QUOTE]I'm thinking my GF would object - you don't want to get me in trouble now, do you? ?
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 13.2005 — Oh, BTW, I never noticed until today... you're Ryan Brill !!!!

*insert fangirl silly scream here*

Dave gave me the link to your site when I was looking for a blogging system, and I fell in love with your personal website.

I use XblogLite on my site, and of course, there are copyright notices scattered all over the website... ?

I modified it a lot ( I mean, mainly the design ). I hope you don't mind...
Copy linkTweet thisAlerts:
@pyroJul 13.2005 — Thats what I get for using an obscure username like 'pyro'. I would switch it to ryanbrill or something, but that name probably wouldn't mean as much on these forums as pyro does by now. ?

And, I'm thrilled you're using and like my software. Wish I had time to finish up TypeSpace (xBlogLite's big brother) and you could give that a try. One of these days (or months...)
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 13.2005 — Of course, I like your software !!! It's really good !

For what I'm doing, at least, it's a lot better than Dotclear, TextPattern or Wordpress. I wanted something flatfile, because my database is a bit crowded every evening, and all the friends I know who have database driven blog systems get a nice blank page instead of their blogs.

i think I'll sign up for the TypeSpace beta !

If you want, I can give you a link to my site when I'm finished, so that you can see your baby in action !!! ?
Copy linkTweet thisAlerts:
@BeachSideJul 14.2005 — I am using a calendar script that he wrote [B][I]for fun[/I][/B] on a church's site I developed! Let me tell you, IT ROCKS!!!! Pyro is DA MAN!!!

I love it, they love it (which is most important), heck even my g/f who could care less about web design loves it lol seriously!

Thanks man!!

::Edit:: Also I must include this...

I wish that everyone that I have to deal with (coding wise) that works for me would code like he does. It was so easy to work with his code it wasn't even funny. Sometimes you get something like that and it almost takes longer to modify it to get it to fit is with your site than it would take if you just made the thing yourself. Not with Pyro!!! Again man THANKS! I owe you one for sure ?
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 14.2005 — You made me curious with this calendar thing... Can I have a look ? ?

BTW, your homepage is really nice !!!
Copy linkTweet thisAlerts:
@BeachSideJul 14.2005 — Yeah you can see it ?

BUT beware I am still cleaning up the code so the alignment of the text in the site may or may not be wacky. It works great in IE6 on Windows ? and for the most part it is great in FF I haven't tried it in Opera yet...

http://fpcdouglasville.org/work/monthly.php
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 14.2005 — hehe, it's really nice, indeed !!!!
Copy linkTweet thisAlerts:
@BeachSideJul 15.2005 — Thanks ?

Your sites are none to shabby either ?


Actually to be quite honest I wish I had your artistic eye.
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 15.2005 — Thanks ?

Your sites are none to shabby either ?


Actually to be quite honest I wish I had your artistic eye.[/QUOTE]

really ? lol !!!

I'm always desperate, because I'm doing things so different from everybody else that nobody likes them, just because they are unusual...

That's my latest baby :

[URL=http://enfantsdelo.free.fr]Enfants de l'Ô[/URL]

Still needs to be fixed ( I redid the layout with percentages, but I haven't had time to change everything... not so much work, but I need at least one hour, and I don't really have all that time... )
Copy linkTweet thisAlerts:
@BeachSideJul 15.2005 — really ? lol !!!

I'm always desperate, because I'm doing things so different from everybody else that nobody likes them, just because they are unusual...

That's my latest baby :

[URL=http://enfantsdelo.free.fr]Enfants de l'Ô[/URL]

Still needs to be fixed ( I redid the layout with percentages, but I haven't had time to change everything... not so much work, but I need at least one hour, and I don't really have all that time... )[/QUOTE]


Love the site!!! Those drop down menus ROCK!!! ?

Only one thing, if I may... The green layout is a bit dark. I could hardly see the little style switching buttons on the bottom.

I just had to leave a message on your tagboard there :p
Copy linkTweet thisAlerts:
@Ness_du_FratauthorJul 15.2005 — Thanks !!! I'll try to make the green thing a bit clearer, but the problem is the different versions colors vary a lot on different screens.

At home, the green version is totaly flashy, and almost hurts the eyes. But on my mac, it's dark.

Thanks for the message ! ( i replied on the tagboard )
×

Success!

Help @Ness_du_Frat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...