PHP +Handling URL Fields

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JFER
Forum Newbie
Posts: 6
Joined: Thu Jul 26, 2007 3:20 pm

PHP +Handling URL Fields

Post by JFER »

Hi,

im using mySQL PHP Generator to ease my coding,

i cannot seem to find what php method converts or parses a string field to treat it as a url

example

my DB has a field SNAME

my SNAME field values are "Here" "There" "EveryWhere"

i would like to be able to encode http://here.php?SNAME=Here when i click on "Here"

how can i do this?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

str_replace(), or more complicated, preg_replace().
JFER
Forum Newbie
Posts: 6
Joined: Thu Jul 26, 2007 3:20 pm

PHP +Handling URL Fields -Rep

Post by JFER »

Thank you for replying so promptly,

i think i may have complicated my request

i would like my array to recognize my strings as url links

for example

SNAME

"Here" - clicking would open "http://SITE.php?HERE"

"There" clinking woudl open "http://SITE.php?There"

it is a simple a href like in html

Thank You
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Response is the same as before.
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

I don't think it can be as simple as I think.. obviously only html but seems liek thats what your asking in a very complicated way..

Code: Select all

<a href="http://SITE.php?Here">here</a>
JFER
Forum Newbie
Posts: 6
Joined: Thu Jul 26, 2007 3:20 pm

PHP +Handling URL Fields -Rep

Post by JFER »

Thank You both

it is exactly like you nathanr

my array populates information, but does not treat the retrieved field as a url

i would like the array to make the hyperlink upon population

<td class="dr"><? echo htmlspecialchars($row["SNAME"]) ?></td>

kinda like

<td class="dr"><? echo href($row["SNAME"]) ?></td>

i tried meddling with curl, but im probably doing work harm than good

is this viable?

PS: Afterwards, i would use strreplace i suppose to help parse my request differently

thanks again feyd
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

still not sure about what you are saying but.. from what I can gather this is what you mean

Code: Select all

<td class="dr"><a href="page.php?SNAME=<? echo htmlspecialchars($row["SNAME"]) ?>"><? echo htmlspecialchars($row["SNAME"]) ?></a></td>
again not sure why you are using htmlspecialchars - but if you've put it in you must have a reason.
JFER
Forum Newbie
Posts: 6
Joined: Thu Jul 26, 2007 3:20 pm

PHP +Handling URL Fields -Rep

Post by JFER »

Still cant get it to work like i mean to say, but i see progress

whats up with htmlspecialcodes?, remember, i'm using a tool to generate my php code

ok

im using LAMP,

my DB is has a field called SNAME, which i want it to act as a hyperlink

my SITE.php file pulls out a field SNAME = "Here"

i would like to tell php that everything in SNAME should be treated as a hyperlink or converted to a hyperlink

or referenced to a hyperlink

thank you for all of yer patience btw
JFER
Forum Newbie
Posts: 6
Joined: Thu Jul 26, 2007 3:20 pm

PHP +Handling URL Fields -Rep

Post by JFER »

Even better,

when [s]u[/s] you got to viewforum.php?f=1

[s]u[/s] you see the AUTHORS field is a cross referenced hyperlink

i wish to achieve this same functionality

Hope this helps

my apologies for the initial confusion
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

If you don't need htmlspecialcharacters, then:

Code: Select all

<td class="dr"><a href="page.php?SNAME=<? echo $row['SNAME'] ?>"><? echo $row['SNAME'] ?></a></td>
That should work fine...
JFER
Forum Newbie
Posts: 6
Joined: Thu Jul 26, 2007 3:20 pm

SOLVED-PHP +Handling URL Fields -Rep

Post by JFER »

Excellent

just what i needed

i appreciated all your efforts and generous help

no more leet speak either

Thanks Again

JFER
Post Reply