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 #182808 is a reply to message #182805] Mon, 16 September 2013 10:57 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
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(at)news(dot)demon(dot)co(dot)uk>
[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: Sat Nov 23 14:20:36 GMT 2024

Total time taken to generate the page: 0.05060 seconds