Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10774
| Message-ID | <2017243.GSzyx3rZ4e@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-09-16 15:41 +0200 |
| Subject | Re: problem with many buttons |
| Newsgroups | comp.lang.php |
| References | <9e813751-629b-4768-beee-e061431da1d4@googlegroups.com> <l16q8i$qgl$1@dont-email.me> |
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).
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
problem with many buttons Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-09-15 23:25 -0700
Re: problem with many buttons Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-16 12:57 +0200
Re: problem with many buttons Fiver <numeralfive@gmail.com> - 2013-09-16 13:32 +0200
Re: problem with many buttons Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-16 15:41 +0200
csiph-web