FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » problem with many buttons
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: problem with many buttons [message #182812 is a reply to message #182810] Mon, 16 September 2013 13:41 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Fiver wrote:

> On 2013-09-16 08:25, Avnesh Shakya wrote:
>> <?php
>> echo "<script type='text/javascript'>function blogId($bgid) {
>> top.location.href = './blogComment.php?id=$bgid'; };</script>";
>> ?>
>>
>> it is going on that page but not contaid this value...
>
> echo "... $bgid ..." will try to interpolate the PHP variable "$bgid"
> into the string. Depending on your settings and whether $bgid actually
> exists, this will result in an error or something you didn't want.
> JavaScript variables and function arguments are not usually prefixed
> with a "$" sign. Try this instead (without the <?php ... ?> around it):
>
> <script type="text/javascript">
> function blogId(bgid) {
> top.location.href = './blogComment.php?id=' + bgid;
> }
> </script>

I am afraid that this code is not going to work until someone with a minimum
clue will be rewriting it. For example,

| echo "<li><button id=$bgname onclick = return(blogId($this))>".
| $row['blogs_name']."</button></li>";

is not going to work already because “$this” will be expanded to "" while
generating the notice “Undefined variable: this”. It must be “this”
instead, and the “onclick“ attribute value must be quoted; but to know that
you have to have at least a basic understanding of HTML, and you have to
know the difference between server-side and client-side code, and between
PHP (used here server-side) and ECMAScript/JavaScript (used here client-
side).


PointedEars
--
When all you know is jQuery, every problem looks $(olvable).
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Confirm PG-related segfault in current PHP version
Next Topic: syntax error or notepad++ error?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Feb 17 09:18:25 GMT 2025

Total time taken to generate the page: 0.03586 seconds