problem with php passing variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepaks85
    New Member
    • Aug 2006
    • 114

    problem with php passing variable

    Dear Friends,

    I have a table which has four rows at one column and on other column it has one cell colspan with 4.

    I have some hyperlinks in each row on left side and I want that by clicking on every link different data should be print on right column.

    But I have failed to do it. Please tell me what shoud I do...

    Here is the code........... ...



    [PHP]<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#1 11111" width="100%" id="AutoNumber1 ">
    <tr>
    <td width="50%" style="padding: 10"><a href="file.php? add=category">A dd
    category</a></td>
    <td width="50%" style="padding: 10" rowspan="4" valign="top">

    <?

    if ($add == "category")
    {
    echo "You can add category here";
    }
    else if($add == "subcat")
    {
    echo "You can add sub category here";
    }
    else if($add == "city")
    {
    echo "You can add City here";
    }
    else if($add == "country")
    {
    echo "You can add country here";
    }



    ?>

    &nbsp;</td>
    </tr>
    <tr>
    <td width="50%" style="padding: 10"><a href="file.php? add=subcat">Add
    sub-category</a></td>
    </tr>
    <tr>
    <td width="50%" style="padding: 10"><a href="file.php? add=city">Add City</a></td>
    </tr>
    <tr>
    <td width="50%" style="padding: 10"><a href="file.php? add=country">Ad d
    Country</a></td>
    </tr>
    </table>[/PHP]


    I know my way of doing this is totally wrong...Please tell me the better way to do this.

    Your advice/help on this will be really appreciated.... .........

    Thanks
    Deepak
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    This coding is working perfectly. do you need to do more apart from printing this dynamic values for the click of hyper links.

    Comment

    • deepaks85
      New Member
      • Aug 2006
      • 114

      #3
      I have also tried this scripting but it's not working for me. When I click on the hyperlinks only the url gets changed. I want to print the value also on the right hand side but it's not getting printed right now. What should I do?

      Please help........... ....

      Thanks
      Deepak


      Originally posted by ajaxrand
      This coding is working perfectly. do you need to do more apart from printing this dynamic values for the click of hyper links.

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        Originally posted by deepaks85
        I have also tried this scripting but it's not working for me. When I click on the hyperlinks only the url gets changed. I want to print the value also on the right hand side but it's not getting printed right now. What should I do?

        Please help........... ....

        Thanks
        Deepak
        This coding is working perfectly in my end. for a example if u click Add City link You can add City here will print in right hand side.

        Comment

        • rohitsavalia
          New Member
          • Apr 2007
          • 8

          #5
          Just replace this code in your body tag and save that file as file.php

          <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#1 11111" width="100%" id="AutoNumber1 ">
          <tr>
          <td width="50%" style="padding: 10"><a href="file.php? add=category">A dd
          category</a></td>
          <td width="50%" style="padding: 10" rowspan="4" valign="top">

          <?
          $add = $_GET["add"];
          if ($add == "category")
          {
          echo "You can add category here";
          }
          else if($add == "subcat")
          {
          echo "You can add sub category here";
          }
          else if($add == "city")
          {
          echo "You can add City here";
          }
          else if($add == "country")
          {
          echo "You can add country here";
          }



          ?>

          &nbsp;</td>
          </tr>
          <tr>
          <td width="50%" style="padding: 10"><a href="file.php? add=subcat">Add
          sub-category</a></td>
          </tr>
          <tr>
          <td width="50%" style="padding: 10"><a href="file.php? add=city">Add City</a></td>
          </tr>
          <tr>
          <td width="50%" style="padding: 10"><a href="file.php? add=country">Ad d
          Country</a></td>
          </tr>
          </table>

          Comment

          Working...