T-String align?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Trishalyn229
Forum Newbie
Posts: 4
Joined: Tue Oct 12, 2004 12:13 am

T-String align?

Post by Trishalyn229 »

Can someone tell me how to align a t-string?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Eh?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

I know G-Strings, but not T-... ;)
Trishalyn229
Forum Newbie
Posts: 4
Joined: Tue Oct 12, 2004 12:13 am

Post by Trishalyn229 »

twigletmac | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

 @ G-string

Maybe I didn't word it right. This is my code:

Code: Select all

<? } elseif ($action == "join"){

   if (!isset($_POST[name]) || !isset($_POST[email]) || !isset($_POST[country])) {

echo "<H2>Thanks</H2><P>Thank you for joining the Sarah Martin fanlisting. You will be added to the member list as soon as possible.</P>";


    
  } elseif (empty($_POST[name]) || empty($_POST[email]) || empty($_POST[country])) {

echo "<H2>Error</H2><P>Oops, it appears you forgot to enter either your email address, your name or your country. Please press the BACK button in your browser and try again.</P>"; 

  } else {
The problem is, the text in the echos is appearing underneath the header instead of being down where the content should be. I'm trying to find out how to align the text to where I need it to be.
User avatar
potsed
Forum Commoner
Posts: 50
Joined: Sat Oct 09, 2004 12:00 pm
Location: - South Africa

Post by potsed »

if i understand correctly... instead of echo u need to put the strings into a var and then echo the variable where u want it to b...

Code: Select all

<?php

$str =  "<H2>Thanks</H2><P>Thank you for joining the Sarah Martin fanlisting. You will be added to the member list as soon as possible.</P>";

?>

Code: Select all

<?php

echo $str;

?>
Trishalyn229
Forum Newbie
Posts: 4
Joined: Tue Oct 12, 2004 12:13 am

Post by Trishalyn229 »

Hmmm. Where do I insert the variable? This code is for phpfanbase...the echo is what's displayed after joining. I'm so lost, rotfl.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

assing your message to a var like

Code: Select all

<?php
    if($succesful)
       $msg="congrats on joining";
    else
        $msg="you forgot something";
?>
then later in your page where you want the message to appear.

Code: Select all

<?php
<html>
<head>
<title>Sarah Martin fan club</title>
</head>
<body>
some other content that you have
<?php if(isset($msg)) echo $msg; ?>
some more content
</body>
</html>
?>
so your message will appear where you want it and only if the variable $msg has been used otherwise nothing will appear.

BTW who is Sarah Martin? As that is my sister name as well.
Trishalyn229
Forum Newbie
Posts: 4
Joined: Tue Oct 12, 2004 12:13 am

Post by Trishalyn229 »

Sarah's a singer from L.A. ;0) She's about to put out a single, etc.
http://www.sarahmartin.org


Thanks...I'm gonna see if that works. I'm trying to use phpfanbase, and this is my first real crack at php.
Post Reply