Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10769

Re: problem with many buttons

Message-ID <81143277.NzZOkkXJ78@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-09-16 12:57 +0200
Subject Re: problem with many buttons
Newsgroups comp.lang.php
References <9e813751-629b-4768-beee-e061431da1d4@googlegroups.com>

Show all headers | View raw


Avnesh Shakya wrote:

>    I have a problem, I have created lot of blogs in my site, and i put
>    those as button, so when i click on button(e.i. blog name), then it
>    should be redirect on other page like. Now I am on page like
>    localhost/blog/blogName.php, here I have all blog buttons, after
>    clicking on a particular button, it should go on
>    localhost/blog/commentShow.php?id=blogName, here blogName is a name of
>    blog that button contains.
> 
> I am doing in page localhost/blog/blogName.php
> <?php
>                     $blogIds = 0;
>                     $sql = "SELECT * FROM user_blogs";
>                     $result = mysqli_query($con, $sql);
>                     while($row = mysqli_fetch_array($result))
>                     {
>                         echo "<ul class='ulBullet horLine'>";
>                         echo "<li>".$row['description']."</li>";
>                         $bgname = 'bgname'.$blogIds;
>                         echo "<li><button id=$bgname onclick =
>                         return(blogId($this))>".
$row['blogs_name']."</button></li>";
>                         $next = "SELECT * FROM users WHERE
>                         user_id=$row[user_id]"; $result12 =
>                         mysqli_query($con, $next); $row12 =
>                         mysqli_fetch_array($result12); echo "<li
>                         style=''><button
>                         class=''>".$row12['usename']."</button></li>";
>                         echo '</ul>'; $blogIds++;
>                     }
>                     ?>
> in last, i added
> <?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...
> 
> please help me, what's wrong with me...

You are not thinking clearly, and you have not done your homework.

Steps you have before you, probably best in that order:

- Learn how to ask questions the smart way:

  <http://www.catb.org/~esr/faqs/smart-questions.html>

- Do not use Google Groups for posting to Usenet, it is broken
  and filled with spam.  Use instead, for example, one of the following:

  <https://en.wikipedia.org/wiki/SeaMonkey>
  <https://en.wikipedia.org/wiki/Mozilla_Thunderbird>
  <https://en.wikipedia.org/wiki/Kontact#Usenet_News_Client>

- Learn HTML [1] and learn how to write *Valid* HTML:
  
  <http://validator.w3.org/>
  <news:comp.infosystems.www.authoring.html>

- Learn *at least* the *basics* of PHP:

  <http://php.net/manual/>

- Get used to a consistent, easily readable and maintainable code style
  for each markup/programming language that you are using.  For example,
  with regard to PHP, you can use

  <http://pear.php.net/manual/en/standards.php> pp.

  as basis for your code style.

- Get a decent integrated development environment that makes all
  of this a lot easier:

  <http://projects.eclipse.org/projects/tools.pdt>

- Learn the difference between server-side and client-side code,
  and between static and generated content. [1]

- Only use “echo” for *generated* content:

  <http://php.net/manual/en/tutorial.firstpage.php>

- Learn to structure your code.  Use functions in order to DRY;
  templates to separate business logic, like database queries,
  from output:

  <https://en.wikipedia.org/wiki/Don%27t_repeat_yourself>
  <http://php.net/manual/en/language.functions.php>
  <http://php.net/include>
  <http://php.net/require>
  <http://php.net/require_once>
  <http://www.smarty.net/>

- Escape input to prevent invalid input and (SQL) code injection:

  <https://en.wikipedia.org/wiki/Code_injection>
  <http://php.net/mysqli_real_escape_string>
  <http://php.net/manual/en/mysqli.quickstart.prepared-statements.php>
  <http://php.net/manual/en/pdo.prepare.php>

- Escape output to prevent invalid output and cross-site scripting (XSS):

  <http://php.net/addslashes>
  <http://php.net/htmlspecialchars>
  <http://php.net/rawurlencode>
  <http://php.net/manual/en/security.php>
  <https://en.wikipedia.org/wiki/XSS>

- Learn object-oriented programming:

  <http://en.wikipedia.org/wiki/Object-oriented_programming>

  With regard to PHP:

  <http://php.net/manual/en/language.oop5.php>

- Learn J(ava)Script/ECMAScript and how to use the DOM APIs. [1]
  See also <news:comp.lang.javascript>

- Learn (My)SQL and how to process (My)SQL query results with PHP
  (in an efficient way):

  <https://en.wikipedia.org/wiki/SQL>
  <http://dev.mysql.com/manual/>
  <news:comp.databases.mysql>
  <http://php.net/manual/en/mysqli.quickstart.php>
  <http://php.net/manual/en/pdostatement.fetchall.php>

[1] <https://developer.mozilla.org/> pp.

YMMV.  HTH.


PointedEars
-- 
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
  -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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