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 Quote Link to comment 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 Quote Link to comment 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 ' ' Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Bigdogcms Posted April 1, 2008 Author Share Posted April 1, 2008 Nope doesn't work still Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.