make a link from an array variable

Thread Solved

Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

make a link from an array variable

 
0
  #1
Jun 25th, 2009
Hello everybody,
anyone can help me with this problem?
instead of just display the child (in array)..echo $Valuechild[$i]."; ";
(see the below code)..I would like to make a link from $Valuechild[$i] to a details of that variable..

  1. <TEXTAREA NAME="comments3" style='width:50%' rows='4'>
  2. <?php
  3. for ($i =0; $i < $ValuenumtableChildren; $i++)
  4. {
  5. //$showsibling = $showsibling.$Valuechild[$i]."; ";
  6. echo $Valuechild[$i]."; ";
  7. ?>
  8. <?php
  9. }
  10. ?>
  11. </TEXTAREA>


I have done like this..
  1. <a href="viewingdetails.php?name=<?php echo $Valuesibling[$i]."?></a>;

however there is an error on that line.
thank you
Last edited by tulipputih; Jun 25th, 2009 at 9:41 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,528
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 137
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: make a link from an array variable

 
0
  #2
Jun 25th, 2009
Is this what you mean?
  1. <TEXTAREA NAME="comments3" style='width:50%' rows='4'>
  2. <?php
  3. for ($i =0; $i < $ValuenumtableChildren; $i++)
  4. {
  5. echo '<a href="viewingdetails.php?name='.$Valuechild[$i].'</a>';
  6. }
  7. ?>
  8. </TEXTAREA>
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - Oopy Doopy Do 2U2!
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

Re: make a link from an array variable

 
0
  #3
Jun 25th, 2009
thanks for your response.
Is this what you mean?
yes..I have tried this beforebut it appears like this:
  1. <a href="viewingdetails.php?name=Science</a>
  2. <a href="viewingdetails.php?name=Matter in Nature</a>

what I need to do is to make a like from Science & Matter in Nature..or whatever .$Valuechild[$i]. is to a detail page.

hope someone can help me.
Last edited by peter_budo; Jun 26th, 2009 at 4:10 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 13
Reputation: brianzet is an unknown quantity at this point 
Solved Threads: 1
brianzet brianzet is offline Offline
Newbie Poster

Re: make a link from an array variable

 
0
  #4
Jun 25th, 2009
This:
<a href="viewingdetails.php?name=<?php echo $Valuesibling[$i]."?></a>;
Should be this:

<a href="viewingdetails.php?name=<?php echo .$Valuesibling[$i].?>"</a>;
Last edited by peter_budo; Jun 26th, 2009 at 4:12 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

Re: make a link from an array variable

 
0
  #5
Jun 25th, 2009
Should be this:

<a href="viewingdetails.php?name=<?php echo .$Valuesibling[$i].?>"</a>;
[/QUOTE]

Hi,
I have tried that as well..but there is error on that line.
thanks anyway.
any other suggestion?
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,528
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 137
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: make a link from an array variable

 
1
  #6
Jun 26th, 2009
any other suggestion?
Could you please post the lines around $Valuechild=array(); and check that it also uses the right casing because I can only see half the picture here.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - Oopy Doopy Do 2U2!
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

Re: make a link from an array variable

 
0
  #7
Jun 26th, 2009
Hi..this is the code. I am sorry if this is not what you mean..
If it doens't..could you please explain..what should I provide here..thank you.

Originally Posted by cwarn23 View Post
Is this what you mean?
  1. <TEXTAREA NAME="comments3" style='width:50%' rows='4'>
  2. <?php
  3. for ($i =0; $i < $ValuenumtableChildren; $i++)
  4. {
  5. echo '<a href="viewingdetails.php?name='.$Valuechild[$i].'</a>';
  6. }
  7. ?>
  8. </TEXTAREA>
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 172
Reputation: Menster is an unknown quantity at this point 
Solved Threads: 22
Menster's Avatar
Menster Menster is offline Offline
Junior Poster

Re: make a link from an array variable

 
0
  #8
Jun 26th, 2009
Hi there, from the past couple of posts, you guys are on the right track, it just seems that no-one remembered to close the anchor tag properly, it should be like this:
  1. #
  2. <?php
  3. #
  4. for ($i =0; $i < $ValuenumtableChildren; $i++)
  5. #
  6. {
  7. #
  8. echo '<a href="viewingdetails.php?name='.$Valuechild[$i].'">LINK TEXT GOES HERE</a>';
  9. #
  10. }
  11. #
  12. ?>
$me = new Person();
if (isset($_COOKIE)){
$me->eat($_COOKIE);
} else { $me->starve(); }
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 81
Reputation: tulipputih is an unknown quantity at this point 
Solved Threads: 0
tulipputih tulipputih is offline Offline
Junior Poster in Training

Re: make a link from an array variable

 
0
  #9
Jun 26th, 2009
hi..
I have tried that one as well..
the same output displayed.. (as below)

<a href="viewingdetails.php?name=Matter in Nature">LINK TEXT GOES HERE</a>
Matter in Nature should be underlined, to be linked to the detail page.

any help??
thanks
Last edited by peter_budo; Jun 28th, 2009 at 5:16 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 172
Reputation: Menster is an unknown quantity at this point 
Solved Threads: 22
Menster's Avatar
Menster Menster is offline Offline
Junior Poster

Re: make a link from an array variable

 
0
  #10
Jun 26th, 2009
It could be the spaces, run the values thru the htmlentities() function
and try again, but i can't see any reason why that link wouldn't work as it is in your last post.
$me = new Person();
if (isset($_COOKIE)){
$me->eat($_COOKIE);
} else { $me->starve(); }
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC