Closed Thread Icon

Preserved Topic: getting info from url into PHP script Pages that link to <a href="https://ozoneasylum.com/backlink?for=20875" title="Pages that link to Preserved Topic: getting info from url into PHP script" rel="nofollow" >Preserved Topic: getting info from url into PHP script\

 
Author Thread
butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-27-2001 21:33

Hi, it's me again.

Everything was going great, I have my html web page done. I have my flat text file for the database done. I have my PHP script to handle the request from the web page working correctly, YEA RIGHT ! The script works great except for one little problem, I have no idea how to get the information that's being passed along with the URL. Silly me, I thought I could just use it like I do a variable from an html form, guess not. I'm thankful to anyone who can enlighten me.

Thanks

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 03-27-2001 22:00

http://www.yoururl.com/index.html?hello=true

then in the variable $hello would be the container for the string 'true'.

That is the way I understand it to work.

You have to give a value and pass the value so that it knows what it is reading from and into.

-mage-

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-27-2001 22:18

Hi WarMage, good to see you back around! I'm passing a date value with my url like so: www.blah.com/show_info.php?page_date=04-01-01

I thought I would automatically have the variable $page_date to use in my script, but this doesn't seem to be true. What I want to know is how to get the value of page_date into my script.

BTW, I was trying to catch you on ICQ, still waiting for authorization from you, let me know.

Thanks

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 03-27-2001 23:26

No in PHP you should have the variable $page_date to use.

I've done it before.


I made a page here all it is:

<?
echo "$page_date";
?>

And it works for me?

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 03-28-2001 00:33

First off, I thought I did authorize you, but just rerequest and I will see if it will work then, good luck with that ICQ has been a beast lately.

Second. Yeah it should work. I think that it is placed into a string format and not a date format. You could parse it into date format.

I know that it works because I use that in most of the scripts that I write.
http://mysite.com/index.html?id=19

<?
$sql = "SELECT * FROM database WHERE id = $id";
$connection = @mysql_connect(...

....
....
?>

And it will use the id which is defined to be 19 and then select the object that has 19 as the value for id from the database. I know that this method works. It also works the same way for forms. You assign a name value to the input type and it is passed to the next page in the URL format just as the above is done. If you use the GET method you will actually see the string being passed.

I know it works...

Send me a message and I will see if I can help you better...

-mage-

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-28-2001 00:35

Thanks Bitdamaged

I started this in a new thread so you didn't think I was a pest, but thanks for joining in.

Your right, I just didn't realize that the value the page was returning had brackets[] around it, so when I said ($page_date == $date) it kept returning false because of the brackets. I fixed it using substr(), but what I was wondering was, are the brackets necessary in the JavaScript where you said [Put date here] or was I a little too literal.

Thanks again

Sash
Paranoid (IV) Inmate

From: Canada, Toronto
Insane since: May 2000

posted posted 03-28-2001 00:46

I start to realize how much easier is that to accomplish then with ASP.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 03-28-2001 00:50

heh
Ya took me too literally.

No brackets necessary.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-28-2001 01:29

Thanks

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-28-2001 04:04

I don't mean to be a friggin idiot, but sometimes I can help it. When I use the openWin function:

<script language = JavaScript>
<!--
function openWin(page_date) {
URL = 'show_info.php?' + page_date;
// Cleans things up
escape(URL);
mywin = window.open(URL,'','height=300, width=200,resizable=no,titlebar=yes,menubar=no,status=no,scrollbars=no,toolbars=no,location=no');
}
//-->
</script>

along with this <a href> tag:

<a href="javascript penWin('04-08-01')">8</a>

it's not passing the variable page_date to my script. When I <? echo $page_date ?> I get nothing

It works fine when I use this one:

<a href="Show_info.php?page_date=[04-08-01]">8</a>

but then I can't pop a new window and control the size of it. Unless there's a way to do it from my PHP script. Any Ideas?

Thanks again

[edit] turning off the slimies[/edit]



[This message has been edited by butcher (edited 03-28-2001).]

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 03-28-2001 05:37

change this line
URL = 'show_info.php?' + page_date;

To this:
URL = 'show_info.php?page_date=' + page_date;
(make sense?)

And just for my piece of mind, theres usually no space between javascript and the :
javascrip penWin etc.......


Walking the Earth like Kane

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-28-2001 12:57

Yes, it makes sense when I read it, but until I saw it I was clueless. Who ever said ignorance is bliss, never tried to do anything with JavaScript.

Thanks for your patience Bitdamaged, sorry for being so thick

Marty

[This message has been edited by butcher (edited 03-28-2001).]

« BackwardsOnwards »

Show Forum Drop Down Menu