1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Adding style to php echo. Need help..

Discussion in 'PHP' started by pat_004, May 12, 2012.

  1. #1
    Ok, guys. So what im trying to do is add a style to my echo, and also to the information that is called from my form.

    The was i have it set up now will change the color and position, but it also prints the {$ } calls.

    How do i get it to format everything correctly, and the information that is being imputed into the form.

    Sorry, im new at php, so if im not making sense just tell me.



    
    
    <?php
                             
     echo '<p style="text-align: center;"><span style="font-size: large; font-family: georgia,palatino; color: #003366;</span></p> This is a {$mandate} {$compname} {$make} {$modelnum} {$wii} </br>;'
                    
    ?>    
    
    
    PHP:
     
    pat_004, May 12, 2012 IP
  2. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #2
    I know what it is.
    You are telling it to print the variable names as a string.
    Do it like this:
    echo '<p style="text-align: center;"><span style="font-size: large; font-family: georgia,palatino; color: #003366;</span></p> This is a' . $mandate . $compname . $make . $modelnum . $wii</br>;'
    PHP:
    I'm pretty sure there's a quicker way, but this should work. if not, just ask again.
     
    Tony Brar, May 12, 2012 IP
  3. kind_of_the_cash

    kind_of_the_cash Active Member

    Messages:
    852
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Yeah try Tony Brar's code.....It has to work.
     
    kind_of_the_cash, May 12, 2012 IP
  4. jonnyblaze

    jonnyblaze Greenhorn

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    <?php

    echo "<p style='text-align: center;'><span style='font-size: large; font-family: georgia,palatino; color: #003366;'></span></p> This is a {$mandate} {$compname} {$make} {$modelnum} {$wii} </br>";

    ?>

    or

    <?php

    echo "<p style=\"text-align: center;\"><span style=\"font-size: large; font-family: georgia,palatino; color: #003366;\"></span></p> This is a {$mandate} {$compname} {$make} {$modelnum} {$wii} </br>";

    ?>
     
    jonnyblaze, May 13, 2012 IP
  5. pat_004

    pat_004 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Your solution will print the form input but it wont and the color of style
     
    pat_004, May 13, 2012 IP
  6. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #6
    I don't really understand what you are trying to do.
     
    Tony Brar, May 13, 2012 IP
  7. pat_004

    pat_004 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Im trying to get this code to print inside a tinymce editor and have the style already configured so you don't have to go in and re style everything each time.

    Im going from a form where you put in information, and trying to have that information print inside the tinymce with the style (color, placing, etc) already added.

    I figured out how to get my items to print inside the tinymce, just cant figure out how to have the style already added.
     
    pat_004, May 14, 2012 IP
  8. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #8
    I don't get it. Sorry, I'm no expert. I don't even know what tinymce is.
     
    Tony Brar, May 14, 2012 IP
  9. pat_004

    pat_004 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    ok i figured it out.. the right way to do it is like this:

    echo "<p style='text-align: center;'><span style='font-size: large; font-family: georgia,palatino; color: #003366;'> This is a {$mandate} {$compname} {$make} {$modelnum} {$wii} </span></p> </br>";
    Code (markup):
     
    pat_004, May 14, 2012 IP
  10. Tony Brar

    Tony Brar Active Member

    Messages:
    220
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #10
    sorry about being such a noob
     
    Tony Brar, May 17, 2012 IP