Bigdogcms Posted April 1, 2008 Share Posted April 1, 2008 Ok, so i have an ajax/php search form that allows me to search my db(right now an xml file) for users/there email what i want to do is create a link that when the user clicks it it fills in the "to" input field here's what i have so far <?php $hint= "<a href='# ' onClick='document.email.Body.value+= (\ " . $z->item(0)->childNodes->item(0)->nodeValue . " \)'> " . $y->item(0)->childNodes->item(0)->nodeValue . " <font color='#999999'>(" . $z->item(0)->childNodes->item(0)->nodeValue . ")</font></a>"; } ?> and here is a working copy of the javascript not in php <a href="# " onClick="document.email.Body.value+= 'Users email'">Click</a> please help Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/ Share on other sites More sharing options...
phpretard Posted April 1, 2008 Share Posted April 1, 2008 Are you getting a JS error or PHP Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506454 Share on other sites More sharing options...
Bigdogcms Posted April 1, 2008 Author Share Posted April 1, 2008 none, it won't echo the javascript because i don't know how to write onClick="document.email.Body.value+= 'Users email'" in php because the actualy value uses ' ' Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506464 Share on other sites More sharing options...
phpretard Posted April 1, 2008 Share Posted April 1, 2008 <? $A="$z->item(0)->childNodes->item(0)->nodeValue"; $B="$y->item(0)->childNodes->item(0)->nodeValue"; $C="$z->item(0)->childNodes->item(0)->nodeValue"; $hint= "<a href='#' onClick='document.email.Body.value+=(" . $A . ") " . $B . "'><font color='#999999'>(" . $C . ")</font></a>"; ?> [code] [/code] Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506480 Share on other sites More sharing options...
phpretard Posted April 1, 2008 Share Posted April 1, 2008 Try it like this and let me know. Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506481 Share on other sites More sharing options...
Bigdogcms Posted April 1, 2008 Author Share Posted April 1, 2008 Nope doesn't work still Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506485 Share on other sites More sharing options...
phpretard Posted April 1, 2008 Share Posted April 1, 2008 What in the value of $z and $y? Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506502 Share on other sites More sharing options...
Bigdogcms Posted April 1, 2008 Author Share Posted April 1, 2008 an email adress and a name it pulls it from an xml file? Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506505 Share on other sites More sharing options...
phpretard Posted April 1, 2008 Share Posted April 1, 2008 Can you echo those values ($y and $z) with out JS? Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506509 Share on other sites More sharing options...
Bigdogcms Posted April 1, 2008 Author Share Posted April 1, 2008 yes here is a sample of the script i'm working on http://bigdogcms.clanska.net/base/Search/search1.php type Chris or josh or coty into the to field it will bring up differnt emails at the end you should see a f that puts words into the To of the field i just need to user the nodes to fill in the email Link to comment https://forums.phpfreaks.com/topic/98978-solved-please-help-with-phpjavascript/#findComment-506526 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.