Jump to content

torsuntsu

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by torsuntsu

  1. Hi everyone, i´m using a form inside a modal in bootstrap and when i hit the button submit it doesn´t execute de action part, that is doesn´t go to the desired page. I don´t know what to do. Please help. The code goes like this: <?php /** * @author Paulo Torres * @copyright 2013 */ include "core/init.php"; ?> <!DOCTYPE html> <html lang="pt"> <?php include 'includes/head.php';?> <body> <?php include 'includes/header.php';?> <div class="container contentor"> <!-- Main hero unit for a primary marketing message or call to action --> <?php include 'includes/hero.php'; ?> <!-- Example row of columns --> <?php $sql= "SELECT id_topico, assunto FROM topicos WHERE topicos.id_topico=". mysql_real_escape_string($_GET['id']); $resultado = mysql_query($sql); if (!$resultado) { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Erro</h2> <hr> </div> <div class="modal-body"> <h3>O tópico não pode ser mostrado!! Por favor tente mais tarde.</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { if (mysql_num_rows($resultado) == 0) { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Erro</h2> <hr> </div> <div class="modal-body"> <h3>Este topico não existe!!</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { while($row=mysql_fetch_assoc($resultado)) { echo ' <table border="1"> <tr> <th colspan="2">'.$row['assunto']. '</th> </tr>'; $sql_posts = "SELECT posts.id_post, posts.conteudo, posts.data, posts.autor, users.user_id, users.first_name, users.last_name FROM posts LEFT JOIN users ON posts.autor = users.user_id WHERE posts.id_post = ". mysql_real_escape_string($_GET['id']); $resultado_posts = mysql_query($sql_posts); if (!$resultado_posts){ echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Erro</h2> <hr> </div> <div class="modal-body"> <h3>Os posts não puderam ser mostrados!! Por favor tente mais tarde.</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { while($posts_row=mysql_fetch_assoc($resultado_posts)) { echo '<tr> <td>'. $posts_row['first_name']. ' '.$posts_row['last_name'] .'<br>'.$posts_row['data'].'</td> <td>'.htmlentities(stripslashes($posts_row['conteudo'])).'</td></tr>'; } echo '</table>'; } } if (logged_in() === false) { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Aviso</h2> <hr> </div> <div class="modal-body"> <h3>Deve efetuar o login para responder.</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Responder</h2> <hr> </div> <div class="modal-body"> <form method="post" action="respostas.php?id='.$row['id_topico'].'"> <textarea id="redactor_content" name="resposta"></textarea><br><br> <input class="btn btn-success" type="submit" value=" Responder "> <a class="btn btn-success" href="forum.php" >Cancelar</a> </form> <br> </div></div>'; } } } ?> <?php include 'includes/footer.php';?> </div> <!-- /container --> <?php include 'includes/javascript.php'; ?> </body> </html> The bold part should work but it doesn´t. Thanks, TorSunTsu
  2. Hi everyone, i´m using a form inside a modal in bootstrap and when i hit the button submit it doesn´t execute de action part, that is doesn´t go to the desired page. I don´t know what to do. Please help. The code goes like this: <?php /** * @author Paulo Torres * @copyright 2013 */ include "core/init.php"; ?> <!DOCTYPE html> <html lang="pt"> <?php include 'includes/head.php';?> <body> <?php include 'includes/header.php';?> <div class="container contentor"> <!-- Main hero unit for a primary marketing message or call to action --> <?php include 'includes/hero.php'; ?> <!-- Example row of columns --> <?php $sql= "SELECT id_topico, assunto FROM topicos WHERE topicos.id_topico=". mysql_real_escape_string($_GET['id']); $resultado = mysql_query($sql); if (!$resultado) { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Erro</h2> <hr> </div> <div class="modal-body"> <h3>O tópico não pode ser mostrado!! Por favor tente mais tarde.</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { if (mysql_num_rows($resultado) == 0) { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Erro</h2> <hr> </div> <div class="modal-body"> <h3>Este topico não existe!!</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { while($row=mysql_fetch_assoc($resultado)) { echo ' <table border="1"> <tr> <th colspan="2">'.$row['assunto']. '</th> </tr>'; $sql_posts = "SELECT posts.id_post, posts.conteudo, posts.data, posts.autor, users.user_id, users.first_name, users.last_name FROM posts LEFT JOIN users ON posts.autor = users.user_id WHERE posts.id_post = ". mysql_real_escape_string($_GET['id']); $resultado_posts = mysql_query($sql_posts); if (!$resultado_posts){ echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Erro</h2> <hr> </div> <div class="modal-body"> <h3>Os posts não puderam ser mostrados!! Por favor tente mais tarde.</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { while($posts_row=mysql_fetch_assoc($resultado_posts)) { echo '<tr> <td>'. $posts_row['first_name']. ' '.$posts_row['last_name'] .'<br>'.$posts_row['data'].'</td> <td>'.htmlentities(stripslashes($posts_row['conteudo'])).'</td></tr>'; } echo '</table>'; } } if (logged_in() === false) { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Aviso</h2> <hr> </div> <div class="modal-body"> <h3>Deve efetuar o login para responder.</h3> </div> <div class="modal-footer"> <a class="btn btn-success" href="forum.php" >Fechar</a> <br> </div></div>'; } else { echo '<div class="modal"> <div class="modal-header" aria-labelledby="modalLabel" aria-hidden="true"> <a class="close" href="forum.php">×</a> <h2>Responder</h2> <hr> </div> <div class="modal-body"> <form method="post" action="respostas.php?id='.$row['id_topico'].'"> <textarea id="redactor_content" name="resposta"></textarea><br><br> <input class="btn btn-success" type="submit" value=" Responder "> <a class="btn btn-success" href="forum.php" >Cancelar</a> </form> <br> </div></div>'; } } } ?> <?php include 'includes/footer.php';?> </div> <!-- /container --> <?php include 'includes/javascript.php'; ?> </body> </html> The bold part should work but it doesn´t. Thanks, TorSunTsu
  3. I don´t know if this is the right place to post this question. This character � appears where an accented character should be. In my database the data appears whith accents, whithout problems. It´s defined whith the collation utf8-general-ci. How can i make the text appear correctly in my pages? Thanks, TorSunTsu
  4. How can i solve this problem? The session_start() function is called in the init.php file like this: <?php session_start(); error_reporting(0); require 'database/connect.php'; require 'functions/general.php'; require 'functions/users.php'; if (logged_in()===true) { $session_user_id = $_SESSION['user_id']; $user_data = user_data($session_user_id,'user_id','username','password','first_name','last_name','email'); if (user_active($user_data['username'])===false){ session_destroy(); header('Location: index.com'); exit(); } } $errors = array(); ?> It´s the first thing being called, and in the other pages i include this file in the very beginning... Help...:-(
  5. Hello, i´m getting a warning: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sistemag/public_html/index.php:3) in /home/sistemag/public_html/core/init.php on line 1 and i can´t figure it out why. I just moved my code to another server and this warning began to apear. On the previous server i got no warnings. Can somebody help me with this one? Many thanks, TorSunTsu
  6. LOL, that was the problem... Thanks Mentalist... You guys are great... Many thanks
  7. I´m really new to this things Mentalist. There is one variable that isn´t echoed. The variable $temp. When i echo that variable nothing shows. Could that be the problem. But if the variable is empty how come does the function move_uploaded_file($temp,"uploads/".$name); work? I don´t get it...
  8. I´ve checked the folder permissions and everything seems to be fine. I´m using filezila and i transfered a file to the folder without problems. I´m really stuck with this one. It seemed like such an easy thing to do.... Thanks for the replies Mentalist.
  9. Tanks Mentalist, but as i said i get no errors. I´ve echoed the content of the variables and everything is fine. I can´t figure it out. Thanks any way...
  10. I´m trying to implement a file upload functionality in my site, but for some reason i´m not being able to do it. I don´t receive any errors, in fact o get a success message. But when i check the folder the file isn´t there, as if it hasn´t been uploaded. The code i´m using is really straight forward: <?php $name = $_FILES['meuFicheiro']['name']; $type = $_FILES['meuFicheiro']['type']; $size = $_FILES['meuFicheiro']['size']; $temp = $_FILES['meuFicheiro']['temp_name']; $error = $_FILES['meuFicheiro']['error']; if ($error > 0){ die("Erro no upload do ficheiro"); } else { move_uploaded_file($temp,"uploads/".$name); echo "Ficheiro transferido com sucesso!"; } ?> Some help would be very appreciated. Thanks, TorSunTSU
  11. Thanks Psycho. Problem solved. You Rock!!!! Torsuntsu.
  12. Hi, i´m using this code to update a database, but i get an error, and i can´t figure it out where the problem is. Here´s the code: function alter_page($page_data, $page_id){ array_walk($page_data,'array_sanitize'); $fields= '`'.implode('`, `',array_keys($page_data)).'`'; $data= '\''.implode('\', \'',$page_data).'\''; mysql_query("UPDATE `paginas` SET ($fields)=($data) WHERE `id`= $page_id")or die(mysql_error()); } Need help. Thanks, TorSunTsu
  13. Ch0cu3r, you saved my life. You rock...Problem solved. Many thanks...:-)
  14. Tanks Ch0cu3r, but the problem is still there. How can i pass the value selected by the user to a variable. That would help. Then i could use the variable to further do database queries. This site rocks.... Many thanks, TorSunTsu
  15. Good evening, i have a problem with some code. I´ve created a dropdownlist that gests it´s values from a database. The dropdownlist is being populated without problems. My problem is that i must get the selected value from the dropdown to complete my task. But i don´t know how. I´d appreciate some help. I send some of the code: echo' <form action="permissions.php" method="post" id="form"> <table><tr><td>Seleccionar Utilizador:</td><td><select name="utilizadores" id="utilizadores">'; $query = mysql_query("SELECT * FROM `users`"); echo'<option value="">****** Utilizador *******</option>'; while(($row = mysql_fetch_array($query))!== false) { echo '<option value="'.$row["user_id"].'">'.$row["first_name"].' '.$row["last_name"].'</option>'; } echo '</select></td> </tr> </table>'; I must get the value selected by the user, without posting because i have to use that value for a database search, so i can display further values. Appreciated some help. I´m desperate :-( Many thanks, TorSunTsu
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.