--- In [email protected], Mark Mckee <[EMAIL PROTECTED]> wrote:
>
> hi all
> 
> i have written a form for a friend that allows him to enter links and 
> some info and then output it in html so he can copy and paste the html 
> into his page.
> ...
> 
> is it possible to write a statement that will detect and emppty
variable 
> and not output that particular line of code?
> 
> also, there is a line break in each line of code incase the blurb text 
> is filled in. if there is just a link and no blurb it still outputs the 
> line break. can this be stopped also?
> 
> for those who think they can help i will make the php code available
for you
> 
> thanks in advance.
> 
> mark m...
>

Mark,

Firstly, definitely post your code. Next, detecting whether the
variable is empty is easy:

<?php

if ( trim ( $_POST['your_html_variable'] ) ) {
     // Code here gets executed if there's something in there
} else {
     // This code will run if the variable is empty or just leave it
}

I would build a foreach statement, and only echo out the link lines if
the $POST or $GET variables are not empty, like so:

<?php

foreach( $_POST as $value ){
    
    if ( trim ($value) ) {
    
        echo '<a href="' . $value . '">Link text... etc. (you get the
idea)
    }//end of the IF statement
}//end of the foreach statement

?>

That's just a basic example, but it should be enough to get you
started. Again, post your code and I can come up with something a
little more complete.

Good luck,
-Nick






Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to