Page 1 of 1

PHP +Handling URL Fields

Posted: Wed Aug 01, 2007 1:30 pm
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?

Posted: Wed Aug 01, 2007 2:00 pm
by feyd
str_replace(), or more complicated, preg_replace().

PHP +Handling URL Fields -Rep

Posted: Wed Aug 01, 2007 2:07 pm
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

Posted: Wed Aug 01, 2007 2:10 pm
by feyd
Response is the same as before.

Posted: Wed Aug 01, 2007 2:14 pm
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>

PHP +Handling URL Fields -Rep

Posted: Wed Aug 01, 2007 2:26 pm
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

Posted: Wed Aug 01, 2007 2:31 pm
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.

PHP +Handling URL Fields -Rep

Posted: Wed Aug 01, 2007 2:51 pm
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

PHP +Handling URL Fields -Rep

Posted: Wed Aug 01, 2007 2:56 pm
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.

Posted: Wed Aug 01, 2007 6:26 pm
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...

SOLVED-PHP +Handling URL Fields -Rep

Posted: Thu Aug 02, 2007 10:47 am
by JFER
Excellent

just what i needed

i appreciated all your efforts and generous help

no more leet speak either

Thanks Again

JFER