simon551 Posted July 16, 2008 Share Posted July 16, 2008 can php access a value stored on the page? I'm trying to modify a spry (adobe ajax library) select box to read a php cookie... I'm a little lost. This is very basic: <option value="1" <?php if (!(strcmp(1, $_SESSION['itemSetting']))) {echo "selected=\"selected\"";} ?>>Regular </option> this is an option value as written using spry: <option value="{itemId}" <?php if (!(strcmp("{itemId}", $_SESSION['itemSetting']))) {echo "selected=\"selected\"";} ?>>{item}</option> I'd like to modify it to be like this: <option value="1" <?php if (!(strcmp(1, $_SESSION['itemSetting']))) {echo "selected=\"selected\"";} ?>>Regular - Client billable</option> do you know of a way to do this? Link to comment https://forums.phpfreaks.com/topic/115110-solved-php-access-javascript-value/ Share on other sites More sharing options...
simon551 Posted July 16, 2008 Author Share Posted July 16, 2008 oh. I totally botched that. this is an option value as written using spry: <option value="{itemId}" >{item}</option> I'd like to modify it to be like this: <option value="{itemId" <?php if (!(strcmp("{itemId}", $_SESSION['itemSetting']))) {echo "selected=\"selected\"";} ?>>Regular - Client billable</option> obviously php just reads {itemId} as text and there would not be any match. But can I somehow pass that info from the javascript? Link to comment https://forums.phpfreaks.com/topic/115110-solved-php-access-javascript-value/#findComment-591966 Share on other sites More sharing options...
spectacularstuff Posted July 16, 2008 Share Posted July 16, 2008 This is how I do it JavaScript Code document.write('<a href="/"><img src="shrink.php?varname=varinfo&var2name=var2info" /></a>'); PHP Code <?php $phpvarname = $_GET["varname"]; // The image pathway returned from JavaScript. (ie. images/) $phpvar2name = $_GET["var2name"]; // The users screen width returned from JavaScript? (ie 800) ?> Wayne Link to comment https://forums.phpfreaks.com/topic/115110-solved-php-access-javascript-value/#findComment-592019 Share on other sites More sharing options...
Guest Xanza Posted July 16, 2008 Share Posted July 16, 2008 it's much more easy to get $_GET information if you ask me... So I would definitely suggest going with what Spectacular said. Link to comment https://forums.phpfreaks.com/topic/115110-solved-php-access-javascript-value/#findComment-592025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.