#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    1
    Rep Power
    0
    I am somewhat new to PHP and I have two questions:
    one I have a table created with a name field I use the following code to paste all the names on the webpage but whenever I view the page it puts a carriage return after every space.

    $iname = mysql_result($result,$i,"name");
    printf($iname);

    for a table value of "Test Item"
    the output turns out somewhat like this:

    Test
    Item

    if anyone can help I would appreciate it.

    my second question is:
    is there anyway I can pass variable from one page to another. in other words I want to make a dynamic page that accesses a different table-row depending upon which link is clicked to get to it. any help with this would also be greatly appreciated.

    thanks
    Jon

  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    There are a couple ways to pass variable among pages.

    Forms: you can pass them in hidden variables.
    <input type=hidden name="myvar" value="<?php echo $myvalue; ?>">

    URL: when creating a link for someone to click on, pass the variable with it. echo "<a href="mypage.php?myvar=$myvalue">click here</a>";

    cookies: cookies can make certain variable available on every page in your site...

    option 2, urls, will probably work best for your situation....hope that helps...

    ---John Holmes...

Similar Threads

  1. display of accents - is this to do with MySQL?
    By Sir Fragalot in forum MySQL Help
    Replies: 1
    Last Post: February 12th, 2004, 11:47 PM
  2. PHP OOP zen?
    By strtoi in forum PHP Development
    Replies: 3
    Last Post: February 12th, 2004, 11:33 AM

IMN logo majestic logo threadwatch logo seochat tools logo