Url variable
I need to send a url variable and am confused how to set it up based upon how my query is set. I need to pass the IPNumber to the be used as a URL variable. Right, the value being passed is the variable. It looks fine for display purposes, but I'm missing some key factor for the url variable to work.
<% int IPNumber;
String CountryName;
String IPName;
ResultSet rset = null;
String sql =
"SELECT IPs.IPNumber, IPs.IPName, IPs.CountryName, count(Titles.IPNumber) AS NumberOfPubs " +
"FROM IPs, Titles " +
"WHERE IPs.IPNumber = Titles.IPNumber " +
"AND IPs.IPName LIKE " +
"'" + request.getParameter("IPName") + "%'" +
"GROUP BY IPs.IPNumber, IPs.IPName, IPs.CountryName ";
try {
rset = stmt.executeQuery (sql);
catch (SQLException e) {
out.println (e);
return;
while (rset.next ())
IPNumber = rset.getInt ("IPNumber ");
CountryName = rset.getString ("CountryName");
IPName = rset.getString ("IPName");
%>
<tr>
<td width="220"><a href="ip_edit.jsp?IPNumber=<%= IPNumber %>"><%= IPName %>
</a> </TD>
<td width="219"><%= CountryName %> </TD>
<td width="262"><%= IPNumber %></TD>
</tr>
<%
%>
</table>
Figured Out. Please Disregard
Similar Messages
-
I've seen many posts about URL Variables, and I've tried implementing the solutions, but nothing seems to be working, so I'm hoping that someone out there might be able to help me with my situation.
I have built a JSP page in JDeveloper. The page must identify the visitor using an id (passed as a url variable) as well as an account_id entered by the user on the page. I've created a procedure in my ModuleImpl.java file that receives both the url variable and account_id and then calls a pl/sql transaction I've created in the database.
Thing is, if I take the procedure, which I've allowed to be shared to the Client interface, and plop it on my JSP Page, I get two inputs, one for the account_id and one for the url variable, meaning the user has to enter the url variable in the field for the procedure to work.
I've tried modifying the value of the field and setting it equal to #{param.id}, but when I run the page, the input becomes a display field and is not sent to my java procedure. I've also tried the FacesContext way of getting a url parameter, but I can't get that to work in my java file.
What I would like to have (or at least what my intensions were when I started this project) is to have the url variable field be hidden and automatically populated with the url variable so that when the customer enters their account_id and clicks submit, both the account_id and url variable are passed.
Any idea on how to implement something like this?You can try setting the value of the parameter in the
pagedef.xml file for your page directly using
expression language.Thanks for your reply! I did that, or at least I think I did. Here is the NameData tag in my pagedef.xml file:
<NamedData NDName="web_hash" NDType="java.lang.String"
NDValue="${bindings.save_new_password_web_hash}"/>
what I've tried doing, is changing the NDValue to the three values below, all of which didn't work (returned null):
NDValue ="${param.id}"
NDValue ="#{param.id}"
NDValue ="${facesContext.externalContext.requestParameterMap['id']}"
is there a different expression I should be using?
Also, I will take a look at the solution you likend to. -
Any way to add a URL variable to EVERY SINGLE url in the site, all at once?
Hi,
I'm managing a web application, and we're looking at changing from using cookies, to passing session variables in every HTTP request to maintain session information.
So basically, I have a variable that needs to be appended to every single URL in the entire site - not just in links, but in cflocation tags etc.
Is there any way to just ADD information to the end of every URL, without otherwise CHANGING anything in that URL?
This site is hand-coded, but I have access to Dreamweaver CS3, so I thought I'd ask if it was possible - it'd save me a bunch of time!
Thanks,
JoeHi, thanks for the reply.
I am familiar with DW's basic find/replace functions, but I don't think it'll work in this case.
See, the URL's are almost ALL unique. Many of them already include other URL variables... This is a pretty server-intensive web application, with a lot of data manipulation and database reads/writes.
So I was hoping for a function that could find all URL's (it could just look for a string containing .cfm), and append the code to include one more variable to the URL.
I see there's a way to use a regex in the find/replace tool, but it'd probably take me as long to write and debug the regex as it'd take to manually mod the URLs lol.
Thanks for any ideas!
On Jun 24, 2010 10:57 AM, SugnaShane <[email protected]> wrote:
It depends on how unique each URL is but you could try the Find and Replace function.
Highlight code in code view
Right Click
Choose "Find and Replace
You can then write the replace code and target a page or entire directory or site. -
Can you pass an array URL variable
Hi,
Doing a form which I want to validate, then re-display with
error messages and the keyed data still in place should there be
errors, or go onto a second form if all ok.
I have tried to use <form
action="<?=$_SERVER['PHP_SELF']?>" but as the various
outcomes result in different screens I can't see how to do it
without having reams of duplicate code - I couldn't make it work
satisfactorily anyway.
So I decided to do it in two stages - form (user screen) + a
separate validation routine which passes validation results back if
there are errors by calling the first screen but with URL variables
to trigger process variations or go onto screen 2 if all ok.
But I'm struggling with this .. two questions:
i) Ideally I would like to use a session variable to pass
actual error messages back to screen one in the event of errors but
if I undertand things correctly (which is by no means certain)
$S_Session is already an associatve array so it wouldn't be so easy
to just add a variable number of messages to it and then know what
you are unpacking elsewhere ... do you know what I mean?
Perhaps if I give you my second question it may help
illustrate what I'm going on about in part 1
ii) The way I have tried to do it is to set it up as an array
($ERRORS) in the validation module and then added a text string
each time I hit a specific error. The hope was that I could then
send this back via the URL for further process but I'm getting
syntax problem so maybe this is not possible .... a brief example
Input Form php:
$ERRORS = array();
$ERRORS = $_GET['errors']
if (sizeof($ERRORS) > 0) {
echo "<p class=\"val_err_hdr\"> *** Validation
error(s) - please correct the entries and try again ***
</p>";
blah blah
Validation php:
$ERRORS=array();
if(!$loginFoundUser) {
$ERRORS[] = "This e-mail address entered has already been
registered on our database - if you have already registered you
can"; }
header("Location: input.form.php?errors=$ERRORS");
When I run this I get a syntax error 'unexpected T_IF' on the
'sizeof'' function condition.
Any help much appreciated..oO(patricktr)
> Doing a form which I want to validate, then re-display
with error messages and
>the keyed data still in place should there be errors, or
go onto a second form
>if all ok.
OK, quite common.
> I have tried to use <form
action="<?=$_SERVER['PHP_SELF']?>"
Avoid short open tags, they are unreliable. Use "<?php
print " instead
of just "<?=" to be safe and independent from the server
configuration.
>but as the
>various outcomes result in different screens I can't see
how to do it without
>having reams of duplicate code - I couldn't make it work
satisfactorily anyway.
What's a "screen" in this case? Just another part of the form
or a
completely different page?
> So I decided to do it in two stages - form (user screen)
+ a separate
>validation routine which passes validation results back
if there are errors by
>calling the first screen but with URL variables to
trigger process variations
>or go onto screen 2 if all ok.
Don't use URL parameters in such a form processing scenario.
Use a
session instead, that's what they are for. The length of URLs
is limited
and there are things you simply don't want to pass between
pages, but
keep on the server instead.
> But I'm struggling with this .. two questions:
>
> i) Ideally I would like to use a session variable to
pass actual error
>messages back to screen one in the event of errors but if
I undertand things
>correctly (which is by no means certain) $S_Session is
already an associatve
>array so it wouldn't be so easy to just add a variable
number of messages to it
>and then know what you are unpacking elsewhere ... do you
know what I mean?
The $_SESSION array itself is strictly associative, the used
indexes
must be strings or the serialization of the session data will
fail.
But if course you can always do things like this:
$_SESSION['errors'] = array();
$_SESSION['errors'][] = 'something went wrong';
> Perhaps if I give you my second question it may help
illustrate what I'm going
>on about in part 1
> ii) The way I have tried to do it is to set it up as an
array ($ERRORS) in the
>validation module and then added a text string each time
I hit a specific
>error. The hope was that I could then send this back via
the URL for further
>process but I'm getting syntax problem so maybe this is
not possible .... a
>brief example ...
As said above - use the session instead.
> Input Form php:
> $ERRORS = array();
> $ERRORS = $_GET['errors']
There's a ';' missing at the EOL (this causes the error you
mentioned
below).
Just a naming hint: Variables should not be named all
uppercase (except
for the predefined superglobal arrays). Such names should be
reserved
for constants. The most common style looks like this:
myNiceFunction()
$myNiceVariable
MY_NICE_CONSTANT
> if (sizeof($ERRORS) > 0) {
if (!empty($_SESSION['errors'])) {
> header("Location: input.form.php?errors=$ERRORS");
The Location URI must be absolute including scheme and
hostname. This is
required by the HTTP spec:
header("Location:
http://$_SERVER[HTTP_HOST
But I'm still not sure why you would need this redirect. The
entire
handling of a form (validation, processing) can be done on a
single
page. Only if the processing succeeds, you might want to
redirect to
some result page.
Micha -
Using URL variable to set initialy selected ds row
Hello everyone,
Could anybody suggest a solution or point me to a working
demo of a script that processes a URL variable and set the current
row accordingly. I am trying to pass a @id of a particlar row in a
URL variable to identify a particluar row, I want to be selected
initially.
Thanks,
NickHy guys,
Just figured it out myself. Here is the script:
<script type="text/javascript">
// define your datasource. I have called it dsGallery. This
name is used later in the script a few times
var dsGallery = new Spry.Data.XMLDataSet("gallery.xml",
"/gallery/photos/photo");
dsGallery.addObserver({ onPostLoad: function(ds, type) {
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
var strQueryString =
strHref.substr(strHref.indexOf("?")).toLowerCase();
var aQueryString = strQueryString.split("&");
for ( var iParam = 0; iParam < aQueryString.length;
iParam++ ){
if (
aQueryString[iParam].indexOf('id' + "=") > -1 ){
var aParam = aQueryString[iParam].split("=");
strReturn = aParam[1];
// look if a row with a matching @id is present in the
datasource
var row = dsGallery.findRowsWithColumnValues({"@id":
strReturn}, true);
// If we have a matching row, make it the current row for the
data set.
if (row) dsGallery.setCurrentRow(row.ds_RowID);
break;
</script>
Thanks to the folks whose scrips were really helfull in
building this one.
Nick -
Url variable doesn't work in IE
Hey guys, my page, www.powerhouse.com/Products/Inventory.php I have a bunch of links that reload the page with a url variable. If FF 3, this works fine, yet in IE 8 the page does not load. My error log has the following error:
script '/var/www/powerhouse/public_html/Products/inventory.php' not found or unable to stat
what stupid IE Hack do I need to get this to work?PHE Admin wrote:
My error log has the following error:
script '/var/www/powerhouse/public_html/Products/inventory.php' not found or unable to stat
what stupid IE Hack do I need to get this to work?
You don't need any IE hack. I have just tested the page in both FF and IE8. It works just fine in both.
However, it's very noticeable from your error log that it refers to inventory.php (all lowercase), whereas the actual page is Inventory.php (initial cap). The other thing that's noticeable is the path, which indicates your server is running on Linux, which is case-sensitive.
From this, I conclude that you originally coded the page using inventory.php, and later updated it. This suggests that IE8 is probably still using a cached version. Clear your cache, and the problem will probably go away. -
Using wildcards in URL variables (very simple question, i know)
Hi all!
Pulling my hair out over this... How do I use wildcards in URL variables? I have this code in compositionReady (which is working):
var myurl = "http://www.mydomain.com/sub1/sub2/pagename";
var currenturl = window.location
if(myurl == currenturl) {
sym.getSymbol("symbolname").play();
It simply makes the symbol "symbolname" play when the current URL matches the variable 'myurl'. However, I want the symbol to play on ALL subpages to http://www.mydomain.com/sub1/sub2/ and therefore it seems logical to put in a wildcard like:
http://www.mydomain.com/sub1/sub2/* or something similar, but I just can't seem to make it work??
Any help will be greatly appreciated!
Best,
ThomasWhat about this ?
var mysubdomain = "http://www.mydomain.com/sub1/sub2/";
var currenturl = window.location.toString();
if(currenturl.indexOf(mysubdomain) === 0) {
sym.getSymbol("symbolname").play();
-Dharmendra -
Parsing List in URL Variable for Query
Hi, I am sending a url variable as in the following example:
http://mypage.com/lookup.cfm?var=1001,1002,1003
I then need to query a database given the string
"1001,1002,1003" in #URL.VAR# to find all records that contain
those RecID numbers in my table. Has anyone done this before, and
if so what is the best way to accomplish this?
Thanks!i tried using the following code, but keep getting an error:
<cfif listLen(url.var) neq 0>
<cfquery name="lookup" datasource="#application.dsn#">
select *
from INVENTORY_CATEGORIES
where
<cfloop list="#url.var#" index="i">
<cfif isNumeric(i)>
CATEGORY_ID= <cfqueryparam cfsqltype="cf_sql_integer"
value="#i#">
and
</cfif>
1=1
</cfloop>
</cfquery>
<cfelse>
<cfset LOOKUP.recordcount=0>
</cfif>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<cfoutput query="lookup">
<tr>
<td> </td>
<td>#row_id#</td>
</tr>
</cfoutput>
</table>
The error I am getting is:
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Invalid use of '.',
'!', or '()'. in query expression 'CATEGORY_ID= Pa_RaM000 and 1=1
CATEGORY_ID= Pa_RaM001 and 1=1'.
The error occurred while processing an element with a general
identifier of (CFQUERY), occupying document position (2:1) to
(2:54).
Date/Time: 07/24/06 09:50:54
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
Remote Address: 127.0.0.1
Query String: var=2042,2045
Any ideas? Also, please keep in mind that the variables I
will send across th eurl may also have letters. For example,
var=m1001,1002,p30014. Thanks! -
Dynamic XML content displayed in HTML using url variable
Hi guys,
The following is code i am having issues with:
<script type="text/javascript">
<!--
var xml_connect_00 = "new Spry.Data.XMLDataSet(";
var xml_connect_01 = "assets/xml/toolkit.xml\",
\"toolkit/section/";
var xml_connect_02 =
"/product\",{sortOnLoad:\"product_name\",sortOrderOnLoad:\"ascending\"";
var xml_connect_03 = ")";
// Create variable to see if there is a ? in the url
var url_input = document.URL.indexOf('?');
// Create variable from ? in the url to the end of the string
var xml_category = document.URL.substring(url_input+1,
document.URL.length);
var dsSoftware =
document.write(xml_connect_00,xml_connect_01,xml_category,xml_connect_02,xml_connect_03);
--->
</script>
dsSoftware is my XML Data set connection string, and by using
document.write, the correct string i want is displayed (in my
html), but - as you can probably guess by now(!) - i want it to
display in the actual Javascript code so i can connect to the xml
file and display the contents depending on the url variable sent.
Is this possible, and if so, am i going about it the right
way? I am not the most proficient at JavaScript, so may have some
ugly code (and not even 100% that this can even be done)!!
Just to give you an outline as to why i am doing this - my
XML file has different categories within it for different products.
I send the category name via a url variable to another page
(containing the above code) that will display the appropriate
category information depending on what url variable is sent.
Cheers in advance for any help.Me again!
Sorry to keep updating, but i have now surpassed my last
question and got the alert to work correctly. The question i have
now regards the following code:
<script type="text/javascript">
<!--
var params = Spry.Utils.getLocationParamsAsObject();
var dsSoftware = new
Spry.Data.XMLDataSet("assets/xml/toolkit.xml", "toolkit/section");
//If the URL parameter 'software' has a value, set the XPath
that includes a filter and then load the data.
if (params.software){
dsSoftware.setXPath("toolkit/section[name =
'"+params.software+"']/product");
dsSoftware.loadData();
//alert(params.software);
//-->
</script>
Everything seems to work without error, but i cannot load my
xml file. The problem, i think, is that my xml heirachy is as
follows:
"toolkit/section/section_name/product"
section_name is unique for each section, and that is what i
am trying to pass through the url variable, so i can display all
the products from that section.
Can anyone tell me what i am doing wrong?
Cheers in advance - again!! -
Dynamic list to generate url variable
Hello, I am using a dynamic list to pull product codes from a
database. I then want to pass the code into a url variable when it
goes to the results page. This is so customers can chose which code
they want to go to a detail page about. I already have the dynamic
list working, I just can not figure out how to embed the selected
code into a url variable. For example I want it to do the
following:
sitename.com/search.php <--- here is where you start and
make the selection then it brings you to:
sitename.com/details.php?code=202 <---- code202 was
selected on previous page in dynamic list.
I know how to do it by pulling results from a database and
generating links for each one, but I need to do it from a dynamic
drop down list.
Here is the coding that I was trying to use:
Thank you for your assistance.Sorry, dumb error on my part. Used method=post rather then
get. -
URL Variables used to set the source property for the VIDEO COMP.
Can you take a url variable and have that variable be the value for the source parameter of the video playback component in flash CS4 or CS5?
Example:
the url with url variable: http://www.mydomain.com/videos/videoplayer.cfm?vplayer=videofile1
the actionscript 3.0
var videoFile:String = [who do I get the url variable's value here?]
myVideoPlayer.source = videoFile +".mp4"
in the end the file that should be playing in the video player is: videofile1.mp4
Thanks.Either
A) Using ExternalInterface, call a Javascript function that returns window.location.search
B) Use Javascript to create FlashVars from window.location.search -
Passing multiple ID's in URL variable
How can I show results from a mysql database from selected ID's using URL variables?
Showing results from one ID works fine:
mypage.php?id=1
But,
My table has 10 rows and I want to show 3 of those rows:
mypage.php?id=1&id=3&id=4
Thanks for a point in the right direction.Are any of you original participants in this thread still around? I'm a bit of a "Jack of all trades, master of none" and I'm having a hell of time. I'm pretty sure this post relates to what I'm trying to do, but I'm just starting in dynamic site building with PHP and I can't seem to translate this situation into my situation.
What I'm trying to do is set up a series of menu items for categories of merchandise (rugs), with subcategories for size. I've succeeded in making links where the user can choose ALL sizes within a category and (separately) I've succeeded in making links where the user can choose a size within a specific category, but I'm not able to create links where the user can choose a specific size OR see all sizes out of a single menu.
Here's what I've got:
3 tables: products, categories & size
The size table has 2 columns - sizeName, and SizeID - the sizeID column is an integer and it links to products table.
The categories table also has 2 columns - categoryName and categoryID - the categoryID column is also an integer which links with the product table
I also built a menu with categories, and each category has a drop down menu where the viewer can choose a size.
Each size link has a parameter which includes the categoryID as well (in following example, all the sizes are within one category):
small - products.php?categoryID=8&sizeID=1
medium - products.php?categoryID=8&sizeID=2
large - products.php?categoryID=8&sizeID=3
On the receiving page (products.php) I created a recordset which looks like this (I'm looking at the recordset dialog box within Dreamweaver CS4):
SELECT price, `description`, categoryID, largeImage, smallImage, sizeID
FROM products
WHERE categoryID = colname AND sizeID = varSize
ORDER BY price ASC
the variables look like this:
Name: colname
type: Integer
default value: -1
Runtime value: $_GET['categoryID'}
Name: varSize
Type: Integer
Default value: 1
Runtime value: $_GET['sizeID']
(Dreamweaver created colname and I created varSize. I'm not really sure why the default values are as they are).
This works, but it doesn't give the "all sizes" option. So I've tried applying what I saw in the thread, by creating this link instead:
products.php?categoryID=8&sizeID=1&sizeID=2&sizeID=3
In the recordset I created the new variables like this (all as integers with 1 as default value):
varSmall = $_GET['sizeID_1']
varMedium = $_GET['sizeID_2']
varLarge = $_GET['sizeID_3']
And I wrote this code:
SELECT price, `description`, categoryID, largeImage, smallImage, sizeID
FROM products
WHERE categoryID = colname AND sizeID = varSize
OR
WHERE categoryID = colname AND sizeID = varSmall AND sizeID = varMedium AND sizeID = varLarge
But within the recordset dialog box, I hit the test button and I got a message about a syntax error.
Am I anywhere near the solution? Any help would be greatly appreciated.
Thanks,
Dave -
Replacing "+" in url variable to spaces
Hello, thanks in advance for your help.
I want to pass a url variable as a title for a page. I want
to separate the words with a "+" in the url.. then when I output it
on the webpage, I want to "+" to get replaced with spaces. Is there
a function that will do that?
Thanks, SteveWhy bother using plus signs as word separators? Use blanks.
Before you put the title into the URL, use the function
URLEncodedFormat() to encode the spaces.
If that does not work for your application some reason (such
as the text is already delimited with plus signs when you get it),
you can use the Replace() function to change the plus signs to
spaces before you display the title. -
Can't find &url variable in this template
I am modifying this template. It originally had only 6 menu
links. I added 5 more. It uses an external .txt file for variables
such as &button1=, &url1=#, etc. In the .fla file I found
how to change/add the button text, but I see nowhere to edit where
it calls for the &url variable. So menu buttons 7 - 11 all link
to &url6 which is the instance I copied when I made them. Can
anyone please enlighten me as to where to change the reference to
the variable for the url ?
The .fla can be downloaded at
http://chopsteakhouse.com/test.fla
The external .txt file is at
http://chopsteakhouse.com/navigation.txt
Thanks in advance for your help.Fix my own problem. I found it in the action script for the
button. -
Hi Experts
I'm using a query with variables and in my WAD report I let the user change the variables and then by using URL variables I re-call my template with the changed variables value. The issue is that, by working like that whenever the user change a variable, I re-call the template with it's original settings and I loose all drilldowns that the user already done in the report.
Is there any way to transfer the current drilldowns in the URL?
Or is there any other way to change variables and affect the report without re-calling the template through URL?
Is there anything new in BI7 for that matter?
Thanks
ShlomiHi Arun
Sorry for the multiple postings.
In any case maybe I didn't explain myself well.
I'm not using the original variable screen, I have created one of my own and I refresh the data by calling the web template again with the new variables value in the URL.
In that case the original template comes up without saving the current navigation.
Shlomi
Maybe you are looking for
-
Need help with the following kernel panic message
Interval Since Last Panic Report: 343442 sec Panics Since Last Report: 1 Anonymous UUID: 20AE5901-94AA-497D-A08A-83DE6176E55A Mon May 16 15:17:40 2011 panic(cpu 1 caller 0xffffff80002d1208): Kernel trap at 0xffffff80002c3
-
I changed my Apple ID/ email address. But iCloud won't let me change from my old one. I don't remember my password to my old one. How do I fix this?
-
HELP! No Longer Able To Download / Sync
Last month I downloaded the latest version of iTunes. When I installed it, I found I could no longer sync up the iPod (version 3.1). I got a pop-up message which read, "The software required for communicating with the iPod is not installed correctly.
-
Audit log of customized table.
Dear experts, I need to trace log of some tables. In spro transacction there is one customize transacction KEDE. This transacction is used to define derivation rules and generates entries with tables names. This records are generated in TKEDRS table.
-
How to fill empty parameter (selection-option)
Hi! On selection screen I have two parameters (s_egrid and s_empid). If user enter something in first (but not in second) one, second one should be filled from database. The problem is that I don't know how to fill the empty parameter. Let's say that