Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 28th, 2003, 03:45 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Hyperlink Mailto: field help

I have set up a database from the tutorial for multicolumn output. http://codewalkers.com/tutorials/15/1.html All is well (finally) except I am trying to create a link from an e-mail address field to the mailto: function.

My code:

php Code:
Original - php Code
  1.  
  2.  
  3.             echo "<TD>" . $data[$i + ($j * $rows)] . "<BR>n";           
  4.             echo $data2[$i + ($j * $rows)] . "n";
  5.             echo $data3[$i + ($j * $rows)] . "<BR>n";
  6.             echo $data4[$i + ($j * $rows)] . "<BR>n";
  7.             echo $data5[$i + ($j * $rows)] . "n";
  8.             echo $data6[$i + ($j * $rows)] . ",n";
  9.             echo $data7[$i + ($j * $rows)] . "<BR>n";
  10.             echo $data8[$i + ($j * $rows)] . "<BR>n";                           
  11.             echo "<a href="mailto:".$data9[$i + ($j * $rows)]."">$data9</a>" . "<P></TD>n";
  12.         }
  13.     echo "</TR>n";
  14.  

$data9 is the email address. I want to create the link "<a href="mailto:myadress@mysite.com">myaddress</a>"

The line above works if I substitute text for the second instance of $data9, but I get an "Array" link to my e-mail address with the code that I have.

What am I doing wrong?

Thanks for any help you can give.

Reply With Quote
  #2  
Old September 28th, 2003, 05:11 PM
Jester Jester is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: England
Posts: 271 Jester User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Hyperlink Mailto: field help

Not quite sure what $data9 contains - but it is an array, so when you use $data9[$i + ($j * $rows)] it puts element $i + ($j * $rows) (I take it that this is something along the lines of myadress@mysite.com)

When you say just $data9 - you do not specify which array element - so it just says 'hey - im an array'! Basically - you are not saying which part of the array to display, just displaying the array as a whole.

If you wanted it to display myadress@mysite.com as the link then change the code to

[
Code:
echo "<a href="mailto:".$data9[$i + ($j * $rows)]."">$data9[$i + ($j * $rows)]</a>" . "<P></TD>n";


If you wanted it to display a differnt element of $data9 then I would need to know what $data9 contains - do a print_r($data9) and post - then I'll try to help

j

Reply With Quote
  #3  
Old September 28th, 2003, 07:48 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Hyperlink Mailto: field help

Thanks for your reply.

When I tried that approach I got "Parse error: parse error, expecting `']'' in /usr/local/etc/httpd/htdocs/editor/search.php on line 183" which is the line that I am having trouble with.

$data9 is the e-mail address from the email field. Before the link worked as long as I put text in the link like this.
php Code:
Original - php Code
  1. echo "<a href="mailto:".$data9[$i + ($j * $rows)]."">E-mail Me</a>" . "<P></TD>n";


What I am trying to do is to put the same e-mail address that is the link in the text portion link.

Reply With Quote
  #4  
Old September 29th, 2003, 05:24 AM
Jester Jester is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: England
Posts: 271 Jester User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Hyperlink Mailto: field help

Yes - sorry, was a long day yesterday but still should of checked more before posting!

You need to end your quote marks exactly like you did with the first use of $data9 to act as the href, i.e.
Code:
echo "<a href="mailto:".$data9[$i + ($j * $rows)]."">".$data9[$i + ($j * $rows)]."</a><P></TD>n";

This should now work...
Don't forget as well, that you can use single quotes within double quote marks, and vice versa so you could do:

echo '<a href="blahdyblahdy">Click Here</a>' and it gets rid of the need for doing /" whenever you need a string within what your outputting...

So your code could be:
Code:
echo '<a href=mailto:'.$data9[$i + ($j * $rows)].'>'.$data9[$i + ($j * $rows)].'</a><P></TD>'

Which should do two things - over longer string concatination, it should help to read the code for debugging. Also the code should parse faster as php will look within any "" strings for variable names i.e. $var1, and will parse the variable name into the value it holds (e.g. the number 5). ''s don't care - they just treat the whole lot as text and output it regardless! This means echo 'value: $var1' would just display like:
value: $var1
whereas echo "value: $var1" would display like:
value: 5

Hope this helps, J

Reply With Quote
  #5  
Old September 29th, 2003, 11:38 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Hyperlink Mailto: Solved

Jester,

Thanks a lot you found what I had been missing. It works great now and I can reuse that code for some other fields that I need. The part that I like is that if the field is empty it just leaves a blank with no empty "Mail To:" text or anything to mislead anyone.

Thanks again.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Hyperlink Mailto: field help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway