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

How can I pass an image parameter in HTML? Is it possible???

Last year, I remember finding a web page describing how to pass the
name of a file to another web page, and have that web page load that
image file.

Now, I can't find my record of that (it was saved on another computer
that I can't get to right now), and I can't remember what search
parameters I used to find it when I googled the topic.

Can anyone point me the right direction? I'd like to use a method that
would be accessible to the most people, and a barrier to as few as
possible.

What I want to do, if possible, is pass the image URL to the web page
as part of the link, and have that page automatically use that image
URL in place of the default image. If you want to see a sample page,
look at http://www.godloveseveryone.org/sample/Personlz.htm ... where
you see the "GOD LOVES JOHN" maze, I'd like to have the link to that
page specify a specific image URL, and have that image show up both
places that the JOHN maze is displayed.

I hope it's possible, otherwise, I'm going to have to have 39,000
different html pages to do the same thing.

And yes, eventually, i need to learn JAVA so that I can write a program
to create those mazes on the fly. Or is there something else that this
old BASIC programmer should learn in order to do it?

John

Jul 23 '05 #1
23 12180
In article <11**********************@f14g2000cwb.googlegroups .com>,
Go******************@gmail.com enlightened us with...

What I want to do, if possible, is pass the image URL to the web page
as part of the link, and have that page automatically use that image
URL in place of the default image.


Is it your page accepting tha parameter? If so, that's easy. Just code it to
do it. Server-side scripting is best, as it won't rely on client-side
scripting support (which not all users have, plus browser issues, etc). You
could use javascript (client-side) for it, but I consider that a last resort.

If it's NOT your page, I have no idea how you could do this. Most scripting
languages don't allow you to change someone else's page. Security.

--
--
~kaeli~
Join the Army, meet interesting people, kill them.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Hi, Kaeli,

The problem is that I know basic HTML, but I have no idea what to do
without an example. The page I referred to is simply what the final
page might look like, but I don't know how to pass parameters.

What do you consider the easiest method to learn, and where do I learn
what I need to learn? I'm guessing that the company hosting my page
allows a number of server-side solutions, if I can learn to use them.
(I know they have several available, but I don't have the list handy
.... that little piece of paper disappeared shortly after I jotted it
down.)

John

Jul 23 '05 #3
In article <11**********************@l41g2000cwc.googlegroups .com>,
Go******************@gmail.com enlightened us with...

The problem is that I know basic HTML, but I have no idea what to do
without an example. The page I referred to is simply what the final
page might look like, but I don't know how to pass parameters.
Oh, that's easy as pie. Just stick it on the end of the URL after a question
mark as a name=value pair. Note that you cannot use special characters
without URL encoding them, but a simple image name should not have this
problem, assuming it doesn't have spaces in it.

<a href="someUrlThatTakesAnImageParam.html?imageSrc=s omeImage.gif">link</a>

What do you consider the easiest method to learn,


Depends. Ever coded before?
Also depends on what is available.

If you need help, I've coded in all the major ones (perl, PHP, JSP, servlets,
cold fusion, ASP [vbscrip/jscript], and ASP.net[C#, VB, and C++]). I'm sure I
could whip up a simple script to load an image based on the input param for
any of them.

The easiest for something this simple is PHP. That would be as simple as
<?php
$imgSrc = $HTTP_GET_VARS["imgSrc"];
if ($imgSrc == "") $imgSrc="defaultImg.jpg";
echo "<img src='" . $imgSrc . "'>";
?>

That would write out
<img src='defaultImg.jpg'>
or
<img src='someImage.gif'>
depending on what was passed.

If you wanted to get really fancy, you could check that the file existed
before writing it. :)

--
--
~kaeli~
Hey, if you got it flaunt it! If you don't, stare at
someone who does. Just don't lick the TV screen, it leaves
streaks.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #4
I would love some help, since you ask.

Literally, I pretty much just know the basic HTML (or you could say
that I know the BASIC html, since my current ability is writing a basic
program to create all the similar HTML pages, but that's a
space-intensive method of writing pages.

My "template" of the HTML file has a few occurrences of "@name@" which
my BASIC program then just substitutes the name, either as part of the
text, or as part of the file name.

Here is a stripped down version of that template. Perhaps looking at it
will give you an idea of what to recommend.

< sample HTML file >

<HTML>
<HEAD><TITLE>God Loves @name@, a solvable puzzle personalized with
@name@'s name</title>
</head>
<BODY><CENTER>
<Table width=99%>
<TR valign=top>
<TD width=170 align=center>
<!-- assorted HTML for left column -->
</td>
<TD align=center>
<!-- center column, some HTML deleted -->
<h1>God Loves @name@<small><small><small><small><BR>
Look for <a href="../god-loves-name.htm"><B>Your Name</b></a> (we now
have over thirty thousand names to choose
from)</small></small></small></small>
</h1>
<img src="@name@.gif">
</td>
<td width=170 align=center>
<!-- assorted HTML for right column -->
</td>
</tr>
</table>
<font color=#FF4400 size=5>Scroll down<small> <small>to see a
<B>LARGE</B> copy of this actual</small> </small>solvable maze</font>
<!-- assorted HTML deleted for readability -->
<h1>God Loves @name@</h1>
<!-- assorted HTML deleted -->
You can solve this maze many times. Just mark new entrances and exits,
and solve it again.
<P>
<img src="@name@.gif" width="100%"><font face="Arial" size=2><BR>
This is an actual solvable maze. There is exactly one solution leading
from entrance to exit.<BR>
No matter where you start, no matter where you finish, there will be
exactly one answer.
<!-- assorted HTML for left column -->
</center>
</body>
</html>

< / sample HTML file >

By the way, if you have some puzzle lovers in your family, I'll be glad
to make you some personalized mazes as a thank you for your advice. For
example, "KAELI IS AMAZING" but with the names and messages of your
choice.

John

Jul 23 '05 #5
In article <11**********************@g14g2000cwa.googlegroups .com>,
Go******************@gmail.com enlightened us with...

My "template" of the HTML file has a few occurrences of "@name@" which
my BASIC program then just substitutes the name, either as part of the
text, or as part of the file name.

This is dynamic HTML, as in each request to the server generates a unique
page? Or is it a template system that you run when you need to in order to
generate static HTML pages?

I didn't know BASIC was still around, other than in VB form...
<img src="@name@.gif">


Where does @name@ come from?
Is it passed into your BASIC program?

And is this stuff meant to run on the internet, or on a CD?

--
--
~kaeli~
If a turtle doesn't have a shell, is he homeless or naked?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6
Yes, old BASIC is still around, and still preferred by some of us. I
use QBX 7.1 (Quick Basic Extended Professional) and like it better than
VB because it is quite a bit faster and because the ability to step
through the execution one line at a time and watch the values change
without having to go to a different window and execute statements.

Right now, I'm using my own program to generate static HTML pages. I
created a "template" of what I wanted each page to look like, then used
BASIC to create all the static pages. You can see what I mean if you
glance at www.GodLovesEveryone.org/a/arleen.htm, ...org/b/bill.htm, and
....org/c/charles.htm

The "@name@" was just my text string so that I could have BASIC search
for that string and substitute the actual name.

I'm actually wanting to create something that lets people find these
puzzles on the Internet. I'm basically giving the puzzles away, but
hoping to eventually make money by receiving donations, getting people
to use my links, and maybe even eventually sell some products if I ever
find a way to do it without having to create the products one at a time
(which is why I don't use CafePress.com, the only such site I've found
so far).

The problem as you know with the HTML solution is that it takes
hundreds of megabytes of storage space to actually store the pages, so
I was hoping to find some kind of dynamic solution, one that would
allow one HTML or similar page to handle the coding part of the page.

I'm not wed to the actual pages in question. If you have some ideas
that would let me load the images on request without using lots of
space, I'd love to hear it. The only reason I don't just load the image
in a new browser is because I wanted to load an enlarged image. If you
go to www.GodLovesEveryone.org/j/john.htm you'll see that it displays
the image twice, once at regular size, and once enlarged to the full
size of the window. (Or is there a way I can do that with <a
href="imagename.gif" width="100%"> for example (I'm doubting that
example would work, I just throw it out as a sample).)

John

P.S. I'm in process of uploading the pages, if your first name starts
with A-K, the html page should load your name ...
www.GodLovesEveryone.org/j/john.htm

If you get a page not found, your name will load if you load
www.GodLovesEveryone.org/j/john.gif, just changing j and john to the
appropriate initial and letter.

(it's slow uploading ... I'm on a dial-up connection ... I'm in rural
Arkansas with no broadband connections available unless I want to spend
lots of money per month and right now, my budget can't even afford the
$100 a month it would take to do satellite internet.)

Jul 23 '05 #7
In article <11**********************@o13g2000cwo.googlegroups .com>,
Go******************@gmail.com enlightened us with...
Yes, old BASIC is still around, and still preferred by some of us. I
use QBX 7.1 (Quick Basic Extended Professional) and like it better than
VB because it is quite a bit faster and because the ability to step
through the execution one line at a time and watch the values change
without having to go to a different window and execute statements.

You can do that with VB...if you use Visual Studio / VS.NET.
I do it all the time. You can set watches, breakpoints, and everything, too.
I mostly use C# for .NET, but I've done some dabbling with VB6. Not that I do
overmuch with C#, either, but I like to putz with new stuff. On the job, I
use Java / J2EE.
Right now, I'm using my own program to generate static HTML pages. I
created a "template" of what I wanted each page to look like, then used
BASIC to create all the static pages.
Okay, what you want can't really be done with static pages unless you do it
with javascript. Since you DO code, you might as well pick up a new server-
side scripting language (less hassle than javascript, since you won't have to
worry about browser support etc). Hosts don't tend to support .NET for free,
so you're probably limited to Perl CGI and/or PHP. Check with your host to
see what they allow and I'll walk you through how to make your pages dynamic
instead of static. That will save a ton of space for you, too.

The "@name@" was just my text string so that I could have BASIC search
for that string and substitute the actual name.
That's what I thought.

The problem as you know with the HTML solution is that it takes
hundreds of megabytes of storage space to actually store the pages, so
I was hoping to find some kind of dynamic solution, one that would
allow one HTML or similar page to handle the coding part of the page.

Yeah, that's what I'm talking about.
BASIC can't do server-side scripting as far as I know. I've never heard of it
being able to. I suppose if you had your own web server set up you could
configure it to (as a cgi-bin executable), but most hosts don't let you dick
around THAT much.
It's always good to learn new things, anyway. :)
I'm not wed to the actual pages in question. If you have some ideas
that would let me load the images on request without using lots of
space, I'd love to hear it.
Sure. Just find out what your hosts allows and I'll show you how to make that
stuff dynamic. People can even enter their own name and it will generate a
page just for them.
Or is there a way I can do that with <a
href="imagename.gif" width="100%"> for example (I'm doubting that
example would work, I just throw it out as a sample).)
You can do that. You can set image sizes to whatever you want.
But don't compress your images as lossy (jpg) if you're going to do that or
the enlarged ones will look awful. I see you use gif, so that should be fine.
A .png might be even better, but I'm not sure of browser support for that
image type. I know my Firefox and MSIE6 do fine with it, but I'm not sure for
other browsers (safari, konqueror, etc).

(it's slow uploading ... I'm on a dial-up connection ... I'm in rural
Arkansas with no broadband connections available unless I want to spend
lots of money per month and right now, my budget can't even afford the
$100 a month it would take to do satellite internet.)


$100 a month!!
Yikes. And I complain about the $40 a month for my broadband...

--
--
~kaeli~
Why do people who know the least know it the loudest?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #8
I'm going to call my support person to ask if they support PHP (I'm
guessing it was one of the acronyms he told me about six months ago
when I moved my pages to his server).

Meanwhile, based on what you've been saying, I've mocked up some ideas
and wanted to bounce them off you:
<a href="someUrl.html?imageSrc=someImage.gif">link</a>
I'm assuming this can be in any subdirectory on the page, not just in
the root directory.
The easiest for something this simple is PHP. That would be as simple as <?php
$imgSrc = $HTTP_GET_VARS["imgSrc"];
if ($imgSrc == "") $imgSrc="defaultImg.jpg";
echo "<img src='" . $imgSrc . "'>";
?>
Does PHP remember the values from one PHP string to the next? Can I do
this in the heading?

<HEAD><TITLE>God Loves
<?php
$name = $HTTP_GET_VARS["name"];
if ($name == "") $name="John";
echo $name;
?>, a solvable puzzle personalized with <?php echo $name; ?>'s
name</title>
</head>

then have these snippets of code in different places in the body:

<h1>God Loves <?php echo $name; ?></h1>

<img src="<?php echo $name; ?>.gif">

<h1>God Loves <?php echo $name; ?></h1>

<img src="<?php echo $name; ?>.gif" width="100%">

Or do I need to do the name-retrieval each place?
If you wanted to get really fancy, you could check that
the file existed before writing it. :)


How would I do that?

Thanks for all the help, and now that I've done the research, I'll have
to contact Brent and hope I haven't wasted your time.

John

Jul 23 '05 #9
> People can even enter their own name and it will generate a
page just for them.
Hi, Kaeli,

I'd love to know how to do that also.
$100 a month!!
Yikes. And I complain about the $40 a month for my broadband...


You don't know the worst of it. I have to pay extra on my telephone
bill in order to even get unlimited calls to my dialup, and that's only
for certain communities served by our phone company. When I had an
office in a town served by the local "ma bell", I had an actual local
phone number for my ISP, but now that I'm working at home, I can't even
call his ISP # because that town five miles away is long distance with
no unlimited calling option. Instead, I pay $12.70 per month to get
sixty minutes to that town and unlimited dialing to a few other towns
further away.

Fortunately, they do have "call forward busy" so when I'm online, my
calls route over to my mother's phone number, which I have an extension
of in my house, so I don't miss calls. (She's 83 ... before my dad
died, he asked me to move to the house near her so I'd be around to
help when she needed a hand).

John

Jul 23 '05 #10
In article <11**********************@l41g2000cwc.googlegroups .com>,
Go******************@gmail.com enlightened us with...
I'm going to call my support person to ask if they support PHP (I'm
guessing it was one of the acronyms he told me about six months ago
when I moved my pages to his server).
You can usually tell on the page that gives you stats and such, or right on
the signup page where they tote all the neat things they offer.
Who is your host?
<a href="someUrl.html?imageSrc=someImage.gif">link</a>


I'm assuming this can be in any subdirectory on the page, not just in
the root directory.


Sure.

Does PHP remember the values from one PHP string to the next? Can I do
this in the heading?
Yes.
And if you put the variable into the session, it will be remembered in all
pages for that visitor for the duration of their visit.

then have these snippets of code in different places in the body:

Yup, no problem.
If you wanted to get really fancy, you could check that
the file existed before writing it. :)
How would I do that?


In php, a simple file_exists($path) returns boolean.

Thanks for all the help, and now that I've done the research, I'll have
to contact Brent and hope I haven't wasted your time.


Nah, never a waste to inform someone of options.
And if server-side scripting isn't supported, you can always change hosts.
My host server costs me $10 a month and supports PHP, cgi-bin, etc and has a
crapload of space and bandwidth. It also comes with a database.
It's not that expensive. Don't let them charge you too much.
If you actually know the person hosting your stuff and it's their server, PHP
can be downloaded and installed for free, so don't let them put one over on
ya. ;)

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #11
In article <11*********************@g14g2000cwa.googlegroups. com>,
Go******************@gmail.com enlightened us with...
People can even enter their own name and it will generate a
page just for them.


Hi, Kaeli,

I'd love to know how to do that also.


That's easy.
Once you have the setup for it to generate based on the passed param, test
for a lack of a passed param and prompt the user for their name.
I can show you how to do that.
--
--
~kaeli~
User: The word computer professionals use when they mean
'idiot'.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #12
Another question I thought of:

1. I just realized that I forgot to take into account the separate
directories, so the filename needs to include the initial, as in
j/john.gif
k/kaeli.gif (sorry, not there, guess I'll have to add it)
l/larry.gif
etc.

I assume this will be the PHP equivalent of
$file = left$($name,1)+"\"+name$+".gif"

2. For some strange reason, probably related to the fact that "CON:" is
the DOS abbreviation for CONsole, I had to add a dash to "c/con.gif" to
make it "c/con-.gif". So I'll use the method you identify for #1 to
take care of #2.

3. Are comparisons case specific? When I check for "$name == 'con'"
does that also check for CON and Con?

I'll call Brent later today to ask a bout PHP. The free calls to
Gravette (the 60 minutes I spoke of) are on the same line I'm connected
on right now, doing uploads that this discussion may make redundant.

John

P.S. I do appreciate all the help.

Jul 23 '05 #13
In article <11*********************@z14g2000cwz.googlegroups. com>,
Go******************@gmail.com enlightened us with...
Another question I thought of:

1. I just realized that I forgot to take into account the separate
directories, so the filename needs to include the initial, as in
j/john.gif
k/kaeli.gif (sorry, not there, guess I'll have to add it)
l/larry.gif
etc.

I assume this will be the PHP equivalent of
$file = left$($name,1)+"\"+name$+".gif"

PHP:
$file = substr($name,0,1) . "/" . $name . ".gif";
(note: slash is forward for web stuff, not backward windows-style)
The dot is the string concat operator in PHP and Perl.
A plus is only for numerics.
Unlike BASIC, PHP and Perl (they are closely related) are not strongly typed
languages (and you don't have to declare variables at all unless you want to
and specify it). This can actually lead to some really stupid problems when
you have typos. *heh*
If you give it a plus sign, it will try to convert the argument to a numeric
data type. If it can't (PHP), you'll get an error (unexpected T_PLUS or some
such, I believe) or get really odd results (perl).
Also note that VB uses the ampersand as string concat.
i.e.
myString = someString & someotherstring
2. For some strange reason, probably related to the fact that "CON:" is
the DOS abbreviation for CONsole, I had to add a dash to "c/con.gif" to
make it "c/con-.gif". So I'll use the method you identify for #1 to
take care of #2.
Well, if you're doing this locally, it will be different. PHP is run from a
web server. You can't test locally without installing Apache / PHP.
IMNSHO, best results achieved on a unix / linux box.
I upload my stuff and test it from there.
File->open just doesn't work for testing dynamically generated pages. They
have to be served from a web server.

Best to give relative references, not absolute. Absolute can give you
problems, especially once you upload. You'd have to change everything.
Use relative paths and a good directory structure.
For example, all my stuff is stored in C:\My Documents\websites\$websitename,
i.e. C:\My Documents\websites\WildAtHeart. So, my stuff in Wild At Heart is
all relatively referenced. There is an images folder. My pages can then do
<img src="images/imageName.jpg"> and the like.
If I move the files to another server, as long as I keep the directory names
the same, no links have to change.

3. Are comparisons case specific? When I check for "$name == 'con'"
does that also check for CON and Con?
You don't want '=='.
You want
if (strnatcasecmp($name,"con"))
That one is case-insensitive.

Full list of PHP string functions:
http://us4.php.net/strings

P.S. I do appreciate all the help.


No problem.
--
--
~kaeli~
Any sufficiently advanced technology is indistinguishable
from magic.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #14
You asked who my host is:

I'm using GravetteOnline.net

One of the advantages is that if I want to, I can put all my changes on
a flash drive and drive it to his office, about six miles from here.

I've left a message for him to call back. Meanwhile, I've put a test
page at www.GodLovesEveryone.org/godloves.php

When I try it in Mozilla Thunderbird, I'm getting asked if I want to
save the file to disk.

When I try it in Internet Explorer, I'm getting strange stuff on my
page, so I'm guessing he doesn't have it activated yet, or perhaps just
not activated specifically for me. I'll have to wait until he calls me
back.

(That's the problem of a small server in a small town, he and his wife
are the main contact people, and when he has to do work for the company
that he telecommutes to, he occasionally has to duck out.)

To give you an idea of how rural we are, I'm in a town of less than a
thousand people. he's in a town of closer to three thousand.

Meanwhile, if you want to glance at it, you can see if I've put
together what you said along with what I found in other places into a
logical whole. For example, at the beginning, I wanted to handle both a
name that was form-input and one that was supplied by the link, so I
put this in the heading:

<HEAD><TITLE>God Loves <?php $name = $_POST['name']; if ($name == "")
$name = $HTTP_GET_VARS["name"]; $file = substr($name,0,1) . "/" . $name
.. ".gif"; if (strnatcasecmp($name,"con")) $file = "c/con-.gif"; echo
$name; ?>, a solvable puzzle personalized with <?php echo $name; ?>'s
name</title>
</head>

Hope I did it right.

Then when I wanted to echo the name as text:

<h1>God Loves <?php echo $name; ?></h1>

and when I wanted to echo the file name, either

<img src="<?php echo $file; ?>.gif">
or
<img src="<?php echo $file; ?>.gif" width="100%">

One question that occurred to me when I was playing with the header is
if the system remembers the variables between links to the page?

In other words, once $name = $_POST['name']; returns a value, is it
going to continue having a value even when another link might be used?
If so, should I be emptying the value with $_POST['name'] = "" after I
retrieve the value?

John

P.S. Just in case Brent doesn't have PHP installed, what should I tell
him about where to download it. You said it was free.

Jul 23 '05 #15
John <Go******************@gmail.com> wrote:
page at www.GodLovesEveryone.org/godloves.php

When I try it in Mozilla Thunderbird, I'm getting asked if I want to
save the file to disk.


That's because the server is sending the page as

Content-Type: application/octet-stream

rather than as

Content-Type: text/html
--
Darin McGrew, da***@TheRallyeClub.org, http://www.TheRallyeClub.org/
A gimmick car rallye is not a race, but a fun puzzle testing your
ability to follow instructions. Upcoming gimmick car rallye in
Silicon Valley: Common Sense (Saturday, April 2)
Jul 23 '05 #16
In article <11**********************@l41g2000cwc.googlegroups .com>,
Go******************@gmail.com enlightened us with...

I've left a message for him to call back. Meanwhile, I've put a test
page at www.GodLovesEveryone.org/godloves.php

When I try it in Mozilla Thunderbird, I'm getting asked if I want to
save the file to disk.
That one got answered. The server isn't sending the right content type. It
needs configured.

Whitespace is your friend. :)
And just use GET, not POST. No need for POSTing.
That way people can just send it in the URL, links, etc. Forms can use GET to
send stuff, too. POST is a way forms send data, mostly, and it should really
be used only when you're going to be doing things like updating a database.
GET is fine (and GET is what it is when it's in the URL).

And don't use the word "file" as a variable name. I shouldn't have -- I
wasn't thinking.
It's a reserved word (actually, it's a function) in PHP and you can
inadvertently do things you don't mean to. Best to not call variable names
the same as reserved words, even if a language allows it.

This is better (though I might even change "$name" to "$firstname" or
something).
Note the shortcut for echoing a variable value or expression is <?= varname
?>.

Watch for word wrap.

<html><head>
<?php
$name = $HTTP_GET_VARS["name"];
if ($name == "")
{
$name = "John"; // change to some default
}
$filename = substr($name,0,1) . "/" . $name . ".gif";
if (strnatcasecmp($name,"con")) $filename = "c/con-.gif"; /* not sure why you
have this here, what it does. */
?>
<title>God Loves <?= $name ?>, a solvable puzzle personalized with
<?= name ?>'s name.</title>
</head>
<body>

<h1>God Loves <?php echo $name; ?></h1>
<h1>God Loves <?= $name ?></h1>
(note, when using shortcut echo, NO SEMI-COLON.)

and when I wanted to echo the file name, either

<img src="<?php echo $file; ?>.gif">
You already had the .gif in there.
<img src="<?= $filename?>">

Note that the path was made as relative (j/john), so you have to have a
subdir under where this file is running from matching that.
i.e.
www.GodLovesEveryone.org/godloves.php
www.GodLovesEveryone.org/j/john.gif

One question that occurred to me when I was playing with the header is
if the system remembers the variables between links to the page?
Only if you save them as session variables (requires cookies on client) or
pass them via the URL or other means. IOW, you have to set it up to do that.
Otherwise, no, they aren't saved.

P.S. Just in case Brent doesn't have PHP installed, what should I tell
him about where to download it. You said it was free.


http://www.php.net

One tip - PHP generates dynamic HTML. Tracing problems is often hard --
unless you remember to view the HTML source with the browser's View->Source.
Sometimes you find easy mistakes (like misspelled directories) there. First
place to look when it doesn't seem to do what you thought it would. B/c the
browser doesn't normally see PHP. All it sees (all it is supposed to see) is
the html generated by your script.

--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #17
I found out why PHP doesn't work.

Brent says he doesn't host PHP because it's mainly a UNIX product, and
each time he has attempted to run PHP, it has crashed his Windows
server.

He suggested that I try to use either ASP or CFM, so any advice in
those areas would be appreciated. Meanwhile, I'll see what I can find
on a web search.

Regarding why I have "con-.gif", it's because, for some strange reason,
Windows won't let me have a file with "Con" as the filename, probably
because "CON" is a reserved word, standing for CONSOLE when doing a
display to the console, as in
COPY filename CON: /b

John

Jul 23 '05 #18
I've got a page mocked up in ASP that lets the user put in his name

http://www.godloveseveryone.org/godloves2.asp

But I haven't figured out how to do it with URL links, can you glance
at it and give me some advice. I did figure out how to capitalize the
first letter of the name, and took care of that funny "Con" error.

Here is what I ended up with, since I know you can't see it on the web
page.

Here's the first part of the file:

<%@ LANGUAGE="VBSCRIPT" %>

<% Dim First
Dim FilNam
First = Request.form("first")
if First="" then First="John"
First = ucase(left(First,1))+mid(First,2)
FilNam = left(First,1)+"/"+First+".gif"
if ucase(First)="CON" then FilNam="C/Con-.gif"
%>
<HTML><HEAD>
<TITLE>God Loves <%=First%>, a solvable puzzle personalized with
<%=First%>'s name</title>
</head>

and the first H1 and image link

<h1>God Loves <%=First%></h1>
<img src="<%=FilNam%>">

and the large image link

<img src="<%=FilNam%>" width="100%">

I'm guessing that you might be able to help me with passing parameters
with the URL??? I also couldn't figure out how to test to see if the
file existed. DIR$ is the function I'm used to, I couldn't find either
it or anything starting with file like in your File_Exists example.

I do appreciate all your help, even all the "wasted time" on PHP helped
me get this one done much faster.

By the way, I didn't think your name was there, but I tested the page
with KAELI and guess what popped up? Hope that's a small thank you.

John

Jul 23 '05 #19
Hi, Kaeli,

In addition to the page that is "mostly working", I'm trying to work on
a slightly different version to strip out spaces and other
non-dash-non-letter characters from the filename, and possibly display
two mazes if they happen to put in a name with a space, first and all.

BUT I'm getting page not found, and getting no errors at all when I try
to load that particular page. Here is the ASP code if you can see
what's causing the error. I've tried breaking down the statements,
changing OR to +, and a few other strange things, so I may have made it
worse.

Here it is:

<%@ LANGUAGE="VBSCRIPT" %>

<% Dim First
Dim FilNam
Dim FilNam2
Dim i
Dim j
Dim FilNam3
Dim FilNam4
First = trim(Request.form("first"))
if First<"A" then First="John"
if First>"zza" then First="John"
First = ucase(left(First,1))+mid(First,2)
FilNam = left(First,1)+"/"+First+".gif"
if ucase(First)="CON" then FilNam="C/Con-.gif"
FilNam2 = left(First,1)+"/"+left$(First,instr(First+" "," ")-1)+".gif"
for i=len(FilNam)-4 to 3 step -1
j=asc(ucase(mid(FilNam,i,1)))
if j<>45 then
if (j<65)+(j>90) then FilNam=left(FilNam,i-1)+mid(FilNam,i+1)
end if
next
if FilNam2<>FilNam then
FilNam3="<img src="+chr$(34)+FilNam2+chr$(34)+"><P>"
FilNam4=left$(FilNam3,len(FilNam3)-4)+" width=100%><P>"
end if
%>
<HTML><HEAD>
<TITLE>God Loves <%=First%>, a solvable puzzle personalized with
<%=First%>'s name</title>
</head>
<BODY><CENTER>
... snip ...
<Table bgcolor=#ffff77">
<TR><TD align=center>
<form action="godloves3.asp" name="form" method="post">
<BIG>Make a Maze</big><BR>
containing<BR>
<I><B>Your</b></i> name:<BR><input type="text" size=15 name="first"
/>
<p><input type="submit" value="Make My Maze">
</form>
<B><font size=3 color=#FF0000>&nbsp;Now</font> <font size=2> more
than</font> <font color=#ff0000 size=3>38,000&nbsp;</font><BR>different
names</b></font>
</td></tr></table>
... snip ...
<h1>God Loves <%=First%></h1>
<img src="<%=FilNam%>"><P>
<%=FilNam3%>
... snip ...
<h1>God Loves <%=First%></h1>
... snip ...
<%=FilNam4%>
<img src="<%=FilNam%>" width="100%">

the occurrence of <%=FilNam3%> and 4%> should, most of the time, just
result in a null string, but when the user puts in "JOHN WILLIAM" for
example, it should attempt to load both "JOHN" and "JOHNWILLIAM" .

I'm flummoxed, and I have to get up early tomorrow for an important
meeting (keep me in your prayers, it's an important meeting), so I'm
quitting now.

Meanwhile, I'm very grateful for the help. I have already linked the
new page to my main web page, www.GodLovesEveryone.org, so the page
that is working that you helped me with is now available
(www.GodLovesEveryone.org/godloves2.asp).

The page that isn't working is www.godloveseveryone.org/godloves3.asp

Thanks again.

John

Jul 23 '05 #20
In article <11**********************@z14g2000cwz.googlegroups .com>,
Go******************@gmail.com enlightened us with...
<%@ LANGUAGE="VBSCRIPT" %>

<% Dim First
Dim FilNam
First = Request.form("first")
That's for form submissions (i.e.POST).
You want querystring for ASP URL params.
First = Request.QueryString("first")

I'm guessing that you might be able to help me with passing parameters
with the URL???
Just link like
http://www.godloveseveryone.org/godl...sp?first=kaeli
I also couldn't figure out how to test to see if the
file existed. DIR$ is the function I'm used to, I couldn't find either
it or anything starting with file like in your File_Exists example.

No, for VBScript you want FileSystemObject, I believe.
Lemme go look...
Yup.
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(path) Then
End If

See:
http://msdn.microsoft.com/library/de...stemobject.asp

Note: vbscript syntax and functions are pretty much the same as full VB. Some
minor differences, but nothing that should screw up something this small.
I do appreciate all your help, even all the "wasted time" on PHP helped
me get this one done much faster.

Hey, no problem.
By the way, I didn't think your name was there, but I tested the page
with KAELI and guess what popped up? Hope that's a small thank you.


Thanks. :)

--
--
~kaeli~
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #21
In article <11**********************@l41g2000cwc.googlegroups .com>,
Go******************@gmail.com enlightened us with...
Hi, Kaeli,

In addition to the page that is "mostly working", I'm trying to work on
a slightly different version to strip out spaces and other
non-dash-non-letter characters from the filename, and possibly display
two mazes if they happen to put in a name with a space, first and all.
A space is not a valid character in the URL. It would be encoded as %20.

BUT I'm getting page not found, and getting no errors at all when I try
to load that particular page. Here is the ASP code if you can see
what's causing the error. I've tried breaking down the statements,
changing OR to +,
VBScript/VB does not support/overload the plus operator (+) for string
concatenation.
It's an ampersand. (&)

You might want to peruse the documentation. It has the operators in there.
http://msdn.microsoft.com/library/de...bscripttoc.asp
First = trim(Request.form("first"))
if First<"A" then First="John"
I'm not sure if this is really what you want.
Many languages will convert this to number comparisons, but VB isn't the
brightest thing I've ever used. You may want to see what other string
functions might do a better job.
It looks like you're trying to make sure the name is an alphabetic string.

Google is my friend. :)

<%
Private Function IsAlpha(byVal string)
dim regExp, match, i, spec
For i = 1 to Len( string )
spec = Mid(string, i, 1)
Set regExp = New RegExp
regExp.Global = True
regExp.IgnoreCase = True
regExp.Pattern = "[A-Z]|[a-z]|\s|[_]"
set match = regExp.Execute(spec)
If match.count = 0 then
IsAlpha = False
Exit Function
End If
Set regExp = Nothing
Next
IsAlpha = True
End Function

If IsNull(First) Or IsEmpty(First) Or Not IsAlpha(First)
First = "John"
End If
%>
FilNam2 = left(First,1)+"/"+left$(First,instr(First+" "," ")-1)+".gif"
Ampersands. Not pluses. And take out the dollar sign.

FilNam2 = left(First,1) & "/"+left(First,instr(First+" "," ")-1) & ".gif"
for i=len(FilNam)-4 to 3 step -1
j=asc(ucase(mid(FilNam,i,1)))
if j<>45 then
if (j<65)+(j>90) then FilNam=left(FilNam,i-1)+mid(FilNam,i+1)
end if
What is that supposed to be doing?
next
if FilNam2<>FilNam then
FilNam3="<img src="+chr$(34)+FilNam2+chr$(34)+"><P>"
And again, use ampersands.
You've got pluses throughout. Change them all to ampersands.
<Table bgcolor=#ffff77">
Unbalanced quote. Will mess things up.
<Table bgcolor="#ffff77">

<TR><TD align=center>
<form action="godloves3.asp" name="form" method="post">
You can just use GET for the method (passes via the URL). Save yourself the
hassle of having to check incoming params of both get and post.

the occurrence of <%=FilNam3%> and 4%> should, most of the time, just
result in a null string, but when the user puts in "JOHN WILLIAM" for
example, it should attempt to load both "JOHN" and "JOHNWILLIAM" .


There will be no space in the actual URL. It will be displayed as %20. I
believe vbscript changes it back to a space for you when you grab the param,
but I am not certain. You'll need to test this.

Good luck with the meeting.

--
--
~kaeli~
He's your God, they're your rules - you burn in Hell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #22
> VBScript/VB does not support/overload the plus operator (+) for
string
concatenation. It's an ampersand. (&)


Actually, it appears to support it, because I'm using + on the working
"godloves2.asp" page.

<%@ LANGUAGE="VBSCRIPT" %>

<% Dim First, FilNam, FilNam2, i, j
First = trim(Request.form("first"))
if First<"A" or First>"zza" then First="John"
First = ucase(left(First,1))+mid(First,2)
FilNam = left(First,1)+"/"+First+".gif"
FilNam2 = left$(First,instr(First+" "," ")-1)
for i=Len(FilNam)-4 to 3 step -1
j=asc(ucase(mid(FilNam,i,1)))
if j<>45 then if j<65 or j>90 then
FilNam=left(FilNam,i-1)+mid(FilNam,i+1)
next
if ucase(First)="CON" then FilNam="C/Con-.gif"
%>

the above comes from www.GodLovesEveryone.org/godloves2.asp

I'm briefly perusing the rest of your comments before leaving for my
meeting. I won't be testing page "3" until later this afternoon or
evening.

John

Jul 23 '05 #23
In article <11*********************@l41g2000cwc.googlegroups. com>,
Go******************@gmail.com enlightened us with...
VBScript/VB does not support/overload the plus operator (+) for

string
concatenation. It's an ampersand. (&)


Actually, it appears to support it, because I'm using + on the working
"godloves2.asp" page.


It won't give an error.
Use the ampersand. Trust me. :)

It was old syntax before they even added support for constants. That was
1996.
"Arithmetic Operators
The arithmetic operators are used with numeric variables and literals and
expressions. (Since VBS at the moment has no constants, they are not an issue
here.) The plus sign (+) can also be used as a string concatenation operator,
but this usage is obsolete and should be used sparingly."

Remember, just because you CAN do something doesn't mean you SHOULD. *heh*
Especially when you're using a non-strongly-typed language. Things tend to
get converted to another data type when you're not looking.

Normal VB is typed, but I'm pretty sure VBS isn't. I think everything is a
Variant in VBS. That can lead to issues.
Are you using ASP classic or ASP.NET? 'Cuz I think they changed a lot between
the two.

--
--
~kaeli~
You feel stuck with your debt if you can't budge it.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #24

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

Similar topics

3
by: Mark Horton | last post by:
I thought would be a super simple project, but I was wrong. I need Help!!!! I am using the Word.Application.Mailmerge.OpenDataSource to try and send a Dynamic Query to my stated Document.Open...
9
by: Martoon | last post by:
I want to instantiate an STL map with my own compare function, and I want to pass a parameter to the compare function that will be stored and used for all comparisons in that map instance. As an...
2
by: Dud Bug | last post by:
I have a query in an Access db that prompts the user for info. (e.g. a primary key representing a company) before compiling the relevant table of results. This works fine in Access but I want to use...
2
by: indhu | last post by:
hi all, Any idea of how to pass image value to shape. i ve 10 image boxes with differnt color gif associated to each image box. when i click image that color has to reflect in shape. pls help me...
3
by: Angus | last post by:
I have a program which when downloaded from a server downloads another program from the same web server and then configures the downloaded program. The trouble is I have to hard code in the...
3
by: John Dalberg | last post by:
I have seen examples for List<T>.FindAll(findthis)where findthis is a predicate. How do I pass a parameter to this predicate so that I have different values to search for? I don't want to use...
13
polymorphic
by: polymorphic | last post by:
I need to pass a parameter to an executable either via URL or link or script or whatever but nothing is working. The .exe is: \\CL001\Mart\OP2\Test1.exe The parameter is:...
2
by: | last post by:
I have a gridview with a textbox in an ItemTemplate, as below. The OnTextChanged event fires okay but how do I pass a parameter to it, I get an error when I try "OnTextChanged(""SomeData"")". I...
6
by: Max | last post by:
i have a event bind function like this(though it is not so robust): bind$=function(o,evt,fn,cb){ var aE='attachEvent'; var aEL='addEventListener'; if(!o&&o){ return o(evt,fn,!!cb); } return...
1
by: Jorge | last post by:
On Oct 23, 10:36 am, Tuxedo <tux...@mailinator.comwrote: Yes: function first_function (PARAMETER) { preload_image = new Image(800,600); preload_image.onload = function () {...
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...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.