473,406 Members | 2,549 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,406 software developers and data experts.

Values incoming from/with an anchor href (basics)

A page has links that want to invoke the same php file,
but pass in different values for a given variable.

<a href=process.php?flag=1> Do One </a>
<a href=process.php?flag=2> Do Two </a>
<a href=process.php?flag=3> Do Three </a>

But, we don't want variables in the URL, right?
So, is it possible to not have them there and
still have multiple links load the same php file,
but with different results?

-Martin
Jul 17 '05 #1
3 3177
On 10 Jan 2004 13:33:45 -0800, mc*******@earthlink.net (martin) wrote:
A page has links that want to invoke the same php file,
but pass in different values for a given variable.

<a href=process.php?flag=1> Do One </a>
<a href=process.php?flag=2> Do Two </a>
<a href=process.php?flag=3> Do Three </a>

But, we don't want variables in the URL, right?
Why not?
So, is it possible to not have them there and
still have multiple links load the same php file,
but with different results?


Depends what you're objecting to.

You can make them look nicer with Apache's mod_rewrite, e.g. transparently
turn /process/1 into process.php?flag=?. But from the looks of the filename,
and the 'Do' part of the link text, it looks like this page will have a
side-effect. In which case, you should be using POST and not GET.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #2
> But, we don't want variables in the URL, right?

An idea propagated by people who don't know security but think they do.
There have been a number of publicized cases where sloppily coded websites
exposed sensitive user information because they failed to validate GET
variables (usually a user id). Placing variables in the URL by itself
doesn't introduce any vulnerability, however.
So, is it possible to not have them there and
still have multiple links load the same php file,
but with different results?


Yes. You can use the path as the identifier.

<a href=process.php/flag1> Do One </a>
<a href=process.php/flag2> Do Two </a>
<a href=process.php/flag3> Do Three </a>

$PATH_INFO would yield "/flag1", "/flag2", or "/flag3".

It's rather pointless though.
Jul 17 '05 #3
"martin" <mc*******@earthlink.net> wrote in message
news:a7*************************@posting.google.co m...
A page has links that want to invoke the same php file,
but pass in different values for a given variable.

<a href=process.php?flag=1> Do One </a>
<a href=process.php?flag=2> Do Two </a>
<a href=process.php?flag=3> Do Three </a>

But, we don't want variables in the URL, right?
So, is it possible to not have them there and
still have multiple links load the same php file,
but with different results?

-Martin


As was posted, I would agree about it being pointless, now thats said, here
is one stupid aproach. Aha, now you guys cant call it stupid, I already did
;)
Wrap you links with other pages
<a href=wa.php> Do One </a>
<a href=wb.php> Do Two </a>
file wa.php
<?php
$flag = "1";
include("process.php");
?>

file wb.php
<?php
$flag = "2";
include("process.php");
?>

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #4

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

Similar topics

14
by: Howard Kaikow | last post by:
Can I use a bookmark to selectively choose the code to be run? For example. Suppose we have the following in an HTML file: <html>
4
by: Jerry Sievers | last post by:
JS Programmers, "I'm a server-side coder PHP, Postgres etc... My question; Given the following anchor <a href="http://www.somesite.com/somefile.html">link text</a> Is there a way to code an...
11
by: yawnmoth | last post by:
If using an onclick event handler to execute javascript when an anchor element is clicked on, what should the href attribute be? #? javascript:void(0)? Something else?
17
by: Christopher Nelson | last post by:
I have a menu tree made up of anchors inside list items in a multi-level list that includes HTML like: <ul id='xx'> <li><a href='conf.cgi' class='menu' target='main' title='Configure stuff'...
3
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a...
9
by: monomaniac21 | last post by:
hi all i want to use hyperlinks to 'load' content by changing the display of div tags. the problem i have is that unless i specify a href the anchor does not change the mouse pointer on hover...
12
by: wavedancer | last post by:
I just tried validating the page I'm working on as <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> and it fails on the PayPal...
1
by: baskarpr | last post by:
Could somebody help me ? I believe this might be elementary, but I am not much familiar with HTML .In my page i have two frames. I have a number of anchor tags in right frame. Every anchor tag in...
20
by: Prisoner at War | last post by:
Hi, People, Is it possible to have an "empty" or "dummy" <a href***without*** the browser jumping back up the page?? I have a hyperlink that doesn't point to another document, but is used to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.