473,659 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1898
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.co m> 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.co m> 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
3356
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 try to send it back. The variable being passed in the form is not being displayed by the php script. This must be so simple that I am just overlooking something. <html> <body> <form action="testecho.php" method="POST">
8
3959
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer http://alexvn.freeservers.com/s1/perfometer.html
27
6190
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 done? regards, Oscar
1
1425
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 of type Object
13
2786
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
2243
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 successfully gotten it working. The only problem I have is with passing parameters to the Windows Forms User control from IE I am using the Object tag to instantiate the IE object I am using param tags inside object tag to pass paramaters but the...
1
3002
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 *obj = new DotNetObject(); obj->UseStringInDotNet( str );
3
1981
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 the WEB site to mail to passing a variable from the WEB site to the ASPX web site to E-Mail to? Hope I explained this correctly. This is a response from another group. There was no way for you to know it, but this is a classic asp newsgroup....
4
4156
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 works real good. Since I don't need the aspx page to do any postback, is there a way to pass a parameter to it with out it finishing the round trip back to the htm page? Thanks. -- moondaddy@newsgroup.nospam
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8535
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.