It is currently Wed May 22, 2019 6:37 pm


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Making javascript variable a PHP variable
PostPosted: Fri Sep 14, 2007 12:03 am 
Newbie
Newbie

Joined: Wed Jun 20, 2007 11:54 pm
Posts: 3
I made this javascript, which is printing a js array, a php variable ($java) :
Code:


<script type='text/javascript'>

document.write(photo[0])

</script>


I am then inserting that variable into another like this:

Code:
$image="$dir/$java"; 



This is creating the source for the image. And of course it outputs the full javascript code instead of printing the array when it is called upon in $image.

My question is how do I get the array name to show instead of the javascript code? I'm thinking it must be done with a function() . . .

P.S. This is how I'm using it:

Code:


//Gets the width and height of the image and outputs it
$theimage = getimagesize($image);
$width = $theimage[0];
$height = $theimage[1];



After that I'm using an if else statement to resize the image if it's width and height exceed a certain amount. However when searching for image it looks for eg. http://website.com/images/<script type='text/javascript'>
document.write(photo[0])
</script>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 15, 2007 12:19 am 
Newbie
Newbie

Joined: Wed Jun 20, 2007 11:54 pm
Posts: 3
I just found out that that can't be done.
Hmm... Ok how about this - is there a way I could include a variable in a new variables name?

Example

Code:

$number="4";


$image4=$file;   //with "4" coming from the variable $number


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011