Hi all,
I was wondering if I can incorporate a variable (actually a calculation)
in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is
there.
TIA
Miki 8 1684
"Michelle" wrote: Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href=’calendar. php?month = $month-1’>go back a month</a>
I wouldn’t think that this is the correct syntax, but the basic idea is there.
TIA
Miki
You can include anything as long as you urlencode it.
-- http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-variable...ict146420.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=490142
"Michelle" <miki@spam_me.n et> wrote in message
news:5F8_c.2868 80$eM2.83490@at tbi_s51... Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is there.
TIA
Miki
Try this:
print "<a href='calendar. php?month={$mon th-1}'>go back a month</a>";
.... or:
print "<a href='calendar. php?month=" . $month - 1 . "'>go back a month</a>";
- JP
*** Michelle escribió/wrote (Sat, 04 Sep 2004 01:13:37 GMT): I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
In a double-quote delimited string you have variable parsing, not
expression parsing. You'll have to use the dot operator to concatenate
strings:
"blah" . funct($foo) . "bla" http://www.php.net/manual/en/languag...ors.string.php
--
--
-+ Álvaro G. Vicario - Burgos, Spain - ICQ 46788716
+- http://www.demogracia.com (la web de humor para mayores de 100 años)
++ «Sonríe, que te vamos a hacer una foto para la esquela»
--
"Michelle" <miki@spam_me.n et> wrote in message
news:5F8_c.2868 80$eM2.83490@at tbi_s51... Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is there.
Formatted String Approach
echo sprintf('<a href="calendar. php?month=%s">G o back a month</a>' ,
$month - 1);
Template Approach
$url = '<a href="calendar. php?month=[month]">Go back a month</a>';
echo str_replace('[month]' , $month - 1 , $url);
Precalculated Approach
$prevmonth = $month - 1;
echo "<a href='calendar. php?month=$prev month'>go back a month</a>";
Take your pick
"Michelle" <miki@spam_me.n et> ???????/???????? ? ???????? ?????????:
news:5F8_c.2868 80$eM2.83490@at tbi_s51... Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is there.
Why don't write just '<a href="calendar. php?month='.$mo nth.'">go back a
month</a>
"Varavva Yevgen aka xa4anypu" <xa******@sakur a.ua> wrote in message
news:ch******** ***@fortress.in tercom.net.ua.. . "Michelle" <miki@spam_me.n et> ???????/???????? ? ???????? ?????????: news:5F8_c.2868 80$eM2.83490@at tbi_s51... Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is there. Why don't write just '<a href="calendar. php?month='.$mo nth.'">go back a month</a>
Because $month contains the number of the current month, and he wants the
link to go to the previous month.
- JP
In article <5F8_c.286880$e M2.83490@attbi_ s51>, Michelle wrote: Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is there.
And the manual is there to tell you what the right syntax is.
Btw, if $current_month == 1, then $previous_month = 12
and if $current_month = 12, then $next_month = 1
--
Tim Van Wassenhove <http://home.mysth.be/~timvw>
"Tim Van Wassenhove" <eu**@pi.be> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:2p******** ****@uni-berlin.de... In article <5F8_c.286880$e M2.83490@attbi_ s51>, Michelle wrote: Hi all,
I was wondering if I can incorporate a variable (actually a calculation) in an href statement such as:
print "<a href='calendar. php?month = $month-1'>go back a month</a>
I wouldn't think that this is the correct syntax, but the basic idea is there.
And the manual is there to tell you what the right syntax is.
Btw, if $current_month == 1, then $previous_month = 12 and if $current_month = 12, then $next_month = 1
-- Tim Van Wassenhove <http://home.mysth.be/~timvw>
the easiest, but not the fastest, IMHO way is
if(date('m',tim e())!==1) $prev_month=dat e('m', time())-1;
else $prev_month=12; This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hal Vaughan |
last post by:
First, I am aware of both SwingUtilities.invokeLater(), and of using Thread
to create a new thread. These are part of the problem.
I want to have something running in the background, while the GUI is
updating. I've done that before without a problem, however, now, I need to
pass variables to the separate Thread or Runnable that I'm using. I'm
using something like this:
//Other code setting things up and updating GUI
//Variables...
|
by: Guy Robinson |
last post by:
I have the code below which parses an expression string and creates tokens.
Can anyone suggest the best of error checking for things like:
Valid variable only obj.attribute -whitespace allowed
test( "ff*2/dd.r..ss r") #additional ..ss -invalid variable.
test( "ff*$24..55/ddr") #double .. and $ -invalid number
test( "ff*2/dd.r.ss r") #variable with double . -invalid variable
|
by: Michael Hill |
last post by:
I created an element on-the-fly using javascript like:
myA=document.createElement("A");
myA.href="Javascript:acton(this)";
myA.className = "smallLink";
myText=document.createTextNode('sometext');
myA.appendChild(myText);
Then when I pressed the link I'd like to change the 'className' of this
link from 'smallLink' to 'biggerLink', but nothing happens.
|
by: tconti |
last post by:
Howdy:
I have 2 general questions regarding the use of XSLT to generate
emails. We have several procecesses that use XSLT to generate emails.
We frequently run into issues where a client complains that they cannot
traverse hrefs in the emails. When er acquire the culprit email it
appears that their reader is not handling the HTML encoded values (i.e.
&) properly. Is this a problem only with older readers (i.e. old
version of Lotus...
|
by: Davíð Þórisson |
last post by:
now in my web I have some global variables to be used in many different
subpages, in the old ASP I simply loaded a variables.asp file into memory
using the eval() function. Now I'd like to use XML but what method would I
use to load the entries from the xml file into memory and make them quickly
accessible globally in the web code? Just need to know what functions
specifically I should start reading about!
Thx
| |
by: Anthra Norell |
last post by:
Hi,
Martin,
SE is a stream editor that does not introduce the overhead and complications of overkill parsing. See if it suits your needs:
http://cheeseshop.python.org/pypi/SE/2.2%20beta
<EAT # delete all unmatched input
"~(?i)<a.*?href.*?>~==\n" # keep hrefs and add a new line
|
by: mark4asp |
last post by:
When I write a url in xhtml, with an unencoded ampersand, like this:
http://localhost:2063/Client/ViewReport.aspx?Ref=58&Type=SUMMARY
the xhtml sytax checker correctly indicates an error, telling me that
it should be:
http://localhost:2063/Client/ViewReport.aspx?Ref=58&Type=SUMMARY
see: <http://www.htmlhelp.com/tools/validator/problems.html#amp>
|
by: etabetapi |
last post by:
I'm trying to build a simple gallery using some thumbnail images to load larger images and SWF files by swapping out the source hrefs. It works okay with images, but I'm having trouble doing the same thing with SWFs (Note: Both galleries exist on separate pages so there is no confusion.) Here is the function that works on the image gallery page:
function showPic (whichpic)
{
if (document.getElementById)
{
...
|
by: r0g |
last post by:
Hi There,
I know you can use eval to dynamically generate the name of a function
you may want to call. Can it (or some equivalent method) also be used to
do the same thing for the variables of a class e.g.
class Foo():
bar = 1
gum = 2
|
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...
|
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,...
| |
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |