473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

passing a string in html


I'm trying to pass a string from the current html page to one I'm
calling. I've read (in the O'Reilly text) this involves using "?",
but there's no example. For example, given I have a standard href
in my code

<a href="new_page.php" (string_I_want_to_pass)>

What is the syntax for passing the string? The new page is html
with some php imbedded, and I'll want to use the string I pass
inside the php code, but that might be a separate issue. The main
question is: How to pass a string in an href call?

Thanks in advance.

B Squared
================================================== ==============
Plagiarize. V, To take the thought or style of another writer
whom one has never, never read.
-- Ambrose Bierce, The Devils Dictionary


Jan 5 '06 #1
4 1886
B Squared wrote:

I'm trying to pass a string from the current html page to one I'm
calling. I've read (in the O'Reilly text) this involves using "?",
but there's no example. For example, given I have a standard href
in my code


Section 3.3 of the URL spec describes the format.

http://www.faqs.org/rfcs/rfc1738.html

You'll probably want to Form URL Encode the data since so many libraries
exist for handling data in the format.

http://www.w3.org/TR/html4/interact/...ml#h-17.13.4.1
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jan 5 '06 #2
On Thu, 05 Jan 2006 13:01:07 -0800, B Squared <nu**@null.com> wrote:
I'm trying to pass a string from the current html page to one I'm
calling.


This is generally a bad idea. For one thing it's easily hackable by
users editing the URL in transit. There used to be a lovely bug on the
Bloomberg.com site (heavyweight financial news) where you could make
_their_ server generate a story with any title you wished, by passing it
in the URL. Imagine a day-traders' blog entry with a post that
mis-represented a story "MegaPharm announce new drug" with a title "FDA
announce enquiry into two-headed babies"

You don't give us enough to know just what or why you're doing, but this
is clearly a PHP problem rather than a HTML one. Making the string for
the href URL is easy (but remember to encode awkward characters such as
" < > & etc.) Using this string in the target page is almost as
simple, a matter of decoding the URL parameters that any PHP primer
should explain.

Jan 5 '06 #3
David Dorward wrote:
Section 3.3 of the URL spec describes the format.

http://www.faqs.org/rfcs/rfc1738.html


As a matter of principle at least, RFC 1738 should not be cited as a
reference as regards to generic URL format (which is what we are
discussing here). In that role, it was obsoleted in 1998 (!) by RFC
2396, which in turn was obsoleted a year ago by RFC 3986 (STD 66), which
is available as simple hypertext at
http://www.apps.ietf.org/rfc/rfc3986.html
Jan 5 '06 #4
Andy Dingley wrote:
On Thu, 05 Jan 2006 13:01:07 -0800, B Squared <nu**@null.com> wrote:

I'm trying to pass a string from the current html page to one I'm
calling.

This is generally a bad idea. For one thing it's easily hackable by
users editing the URL in transit. There used to be a lovely bug on the
Bloomberg.com site (heavyweight financial news) where you could make
_their_ server generate a story with any title you wished, by passing it
in the URL. Imagine a day-traders' blog entry with a post that
mis-represented a story "MegaPharm announce new drug" with a title "FDA
announce enquiry into two-headed babies"


Point taken.
You don't give us enough to know just what or why you're doing, but this
is clearly a PHP problem rather than a HTML one. Making the string for
the href URL is easy (but remember to encode awkward characters such as
" < > & etc.) Using this string in the target page is almost as
simple, a matter of decoding the URL parameters that any PHP primer
should explain.


Here's what I'm trying to do.
1) the user clicks on an image on the index page
2) this in turn calls / references a page, and passes an argument (the
string) that is uses to build a page dynamically. The argument is
is used in PHP and MYSQL to build the contents of the dynamic page.
3) So the problem really has two parts, a) passing the argument to the
target page, and extracting it so can be used inside the target
page.

Nothing needs to be passed back. So in programming terms, this is a
pass by value problem, if that analogy helps any.

Thanks in advance for any help.

B Squared
Jan 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Walt Last | last post by:
I have a RedHat Linux 8.0 system. I have started the httpd (Apache 2.0.40) process and can now fetch pages from the server. I have a test htlm page which has a form that will take a string and...
8
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
1
by: AA | last post by:
I have this simple class public class Person { public Person(){} public String Name = String.Empty; public String LastName = String.Empty; } and this procedure that has one input parameter...
13
by: Maxim | last post by:
Hi! A have a string variable (which is a reference type). Now I define my Method like that: void MakeFullName(string sNamePrivate) { sNamePrivate+="Gates" }
0
by: Neelima Godugu | last post by:
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings requirement inorder to do the above. I have...
1
by: muntyanu | last post by:
Hi all, I am passing string from C++ to C# but not sure which way is more correct. Here it is: First approach: CDAnetCSharpHooks::PassString( ) { char str = "String to pass"; DotNetObject...
3
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on...
4
by: moondaddy | last post by:
I have a htm page where I need to pass some data to an aspx page as a means of sending data to the database. I don't need to see the aspx page so I was going to put it in a hidden iframe. This...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.