Jump to content

Recommended Posts

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.