For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2004 > Re: Passing values from web page to php script









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Passing values from web page to php script
Shane Lahey

2004-05-26, 11:31 pm

On Thu, 27 May 2004 01:17:29 GMT, Bartosz Wegrzyn <blwegrzyn@leoxn.ws>
wrote:

>Hi Everyone,
>
>First excuse my language and the way I explain things.
>I try to be clear enough.
>
>I do have a simple system that processes "customers and work orders" using one script file
>written in php (process.php) I use forms to pass a values to my script:
>
>..part of the code
><FORM action="process.php" method="get" name="form1" id="form1">
><INPUT type="submit" name="select" value="open">
>..
>
>In my script I simply check what is the value of "select" and then
>I start the code depending on the value.
>
>What I would like to do now, is to create a link that passes values
>to the process.php file without using forms.
>The link would look like this
><php?
><a href='https://lexon.ws/corporate/process.php?customerid=");
>echo ("$row[customerid]");
>echo ("&workorderid=");
>echo ("$row[workorderid]");
>echo ("'>open</a>
>?>
>
>The problem is that my php script does not know which function to start.
>
>How can I pass a value "using this link" to my script so it would know
>which function to start. Let say I want to pass script=5.
>
>Thanks
>


not exactally sure what you mean.... but i think i might
you want the script to do something different depending on what
script=??

<?php

$url =
sprintf("https://lexon.ws/corporate/process.php?customerid=%d&workorderid=%d&script=5",
intval($row['customerid']), intval($row['workorderid']));

?>
<a href="<?php echo $url; ?>">open</a>


..... now in your script you can.....
if (isset($_GET['script']))
$scriptNum = intval($_GET['script']);
else
$scriptNum = 0;

switch($scriptNum)
{
case 1:
// do things for script=1
break;
case 2:
// do things for script=2
break;
default:
// do things for invalid script (script=0, or other invalid #)
break;
}

RootShell

2004-05-27, 8:31 am

"Shane Lahey" <s.lahey@roadrunner.nf.net> escreveu na mensagem
news:vhlab0lvcovmb66j4prt0b1nrroip0fe2f@
4ax.com...
> On Thu, 27 May 2004 01:17:29 GMT, Bartosz Wegrzyn <blwegrzyn@leoxn.ws>
> wrote:
>
using one script file[color=darkred]
>
> not exactally sure what you mean.... but i think i might
> you want the script to do something different depending on what
> script=??
>
> <?php
>
> $url =
>

sprintf("https://lexon.ws/corporate/process.php?customerid=%d&workorderi
d=%d&script=5",
> intval($row['customerid']), intval($row['workorderid']));
>
> ?>
> <a href="<?php echo $url; ?>">open</a>
>
>
> .... now in your script you can.....
> if (isset($_GET['script']))
> $scriptNum = intval($_GET['script']);
> else
> $scriptNum = 0;
>
> switch($scriptNum)
> {
> case 1:
> // do things for script=1
> break;
> case 2:
> // do things for script=2
> break;
> default:
> // do things for invalid script (script=0, or other invalid #)
> break;
> }
>


Hey this is pretty good, but now i have a problem.

After i use your link method, when i return to the initial page the link is
already marked pink (as if it was already click) is there anyway to reset
the link so that IE doesnt show that you already clicked this link
previouslly?



Bartosz Wegrzyn

2004-05-27, 11:31 am

Thanks,

I fell stupid that I did not think about this that way.
Thank You.

On Thu, 27 May 2004
00:22:38 -0230, Shane Lahey wrote:

> On Thu, 27 May 2004 01:17:29 GMT, Bartosz Wegrzyn <blwegrzyn@leoxn.ws>
> wrote:
>
>
> not exactally sure what you mean.... but i think i might
> you want the script to do something different depending on what
> script=??
>
> <?php
>
> $url =
> sprintf("https://lexon.ws/corporate/process.php?customerid=%d&workorderid=%d&script=5",
> intval($row['customerid']), intval($row['workorderid']));
>
> ?>
> <a href="<?php echo $url; ?>">open</a>
>
>
> .... now in your script you can.....
> if (isset($_GET['script']))
> $scriptNum = intval($_GET['script']);
> else
> $scriptNum = 0;
>
> switch($scriptNum)
> {
> case 1:
> // do things for script=1
> break;
> case 2:
> // do things for script=2
> break;
> default:
> // do things for invalid script (script=0, or other invalid #)
> break;
> }


Shane Lahey

2004-05-30, 4:31 am

On Thu, 27 May 2004 11:53:36 +0100, "RootShell" <Rootshell@netcabo.pt>
wrote:


>Hey this is pretty good, but now i have a problem.
>
>After i use your link method, when i return to the initial page the link is
>already marked pink (as if it was already click) is there anyway to reset
>the link so that IE doesnt show that you already clicked this link
>previouslly?
>
>


you need to do that with stylesheets :D

the following will keep links blue, and no underline, when mouse is
hovered above a link, the link will stay blue & get underlined..

<style type="text/css">
A {
color: #0000FF;
text-decoration: none;
}

A:HOVER {
color: #0000FF;
text-decoration: underline;
}
</style>

Shane Lahey

2004-05-30, 4:31 am

bahf!, no need to feel stupid, , that's how we all learn ... now the
next time you'll know how to do it :D


On Thu, 27 May 2004 14:29:26 GMT, Bartosz Wegrzyn <blwegrzyn@leoxn.ws>
wrote:

>Thanks,
>
>I fell stupid that I did not think about this that way.
>Thank You.
>


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com