Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Quick If Statement Query

  • 31-01-2009 11:38am
    #1
    Registered Users, Registered Users 2 Posts: 3,875 ✭✭✭


    Can anyone tell why this might not work?


    <?php if (($row_Recordset1 == "processing")){
    echo <a href="mgcancelcourse.php?registratrion=$farm">cancel</a> ; } ?>


    it is withing a table here is the full part, the first if statement works fine, but when i try and use the link i am having no luck, i can print the link just not as a hyperlink

    <?php $farm = $row_Recordset1; ?>

    <td> <?php if (($row_Recordset1 != "processing")){
    echo 'n/a' ; } ?>

    <?php if (($row_Recordset1 == "processing")){
    echo <a href="mgcancelcourse.php?registratrion=$farm">cancel</a> ; } ?>



    </td>


Comments

  • Closed Accounts Posts: 30 Mr. Magoo


    Can anyone tell why this might not work?


    <?php if (($row_Recordset1 == "processing")){
    echo <a href="mgcancelcourse.php?registratrion=$farm">cancel</a> ; } ?>


    it is withing a table here is the full part, the first if statement works fine, but when i try and use the link i am having no luck, i can print the link just not as a hyperlink

    <?php $farm = $row_Recordset1; ?>

    <td> <?php if (($row_Recordset1 != "processing")){
    echo 'n/a' ; } ?>

    <?php if (($row_Recordset1 == "processing")){
    echo <a href="mgcancelcourse.php?registratrion=$farm">cancel</a> ; } ?>



    </td>

    You're missing some quotes around the string you're trying to echo out.

    You have to wrap any string of text in single or double quotes. If you use double quotes PHP can parse the string to replace any variables with their value.

    [PHP]

    <?php
    if (($row_Recordset1 == "processing")){
    echo "<a href=\"mgcancelcourse.php?registratrion=$farm\">cancel</a>"; }
    ?>

    [/PHP]


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    Your quotes seem to be missing / messed up.

    [php]
    <?php if (($row_Recordset1 == "processing")){
    echo "<a href=\"mgcancelcourse.php?registratrion=$farm\">cancel</a>"; } ?>
    [/php]

    ^^ try that.


    //edit
    D'oh! Too slow :)


  • Registered Users, Registered Users 2 Posts: 3,875 ✭✭✭ShoulderChip


    Perfect,
    thank you both very much.


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    Another way to write this could be:
    [php]
    <?php echo $row_Recordset1 == "processing" ? "<a href=\"mgcancelcourse.php?registratrion=$farm\">cancel</a>" : ""; ?>
    [/php]


Advertisement