Jump to content
Fórum Script Brasil
  • 0

Help!? Enviar registros marcados no checkbox


pedro luiz

Question

Olá amigos, preciso de help, sou novato na area e tenho um lista de dados gerado em php e gostaria de enviar somente registros marcados no checkbox e enviar por e-mail no DW. Fico grato desde já ajuda. Obrigado!

<form action="enviar.php" method="post" enctype="multipart/form-data" name="form1" id="form1">

<table border="0" align="center" cellpadding="4" cellspacing="4" class="tabela">

<tr bgcolor="#000000">

<td class="titulobranco">Codigo:</td>

<td class="titulobranco">Endereco:</td>

<td class="titulobranco">Referencia:</td>

<td class="titulobranco">Localizacao:</td>

<td class="titulobranco">Produto:</td>

<td class="titulobranco">Status:</td>

<td class="titulobranco">Marcar</td>

<td><img src="f.png" width="20" height="20" /></td>

</tr>

<?php do { ?>

<tr bgcolor="<?php echo $row_dados['cor1']; ?>">

<td><?php echo $row_dados['codponto']; ?></td>

<td><?php echo $row_dados['end']; ?></td>

<td><?php echo $row_dados['ref']; ?></td>

<td><?php echo $row_dados['local']; ?></td>

<td bgcolor=<?php echo $row_dados['cor2]; ?>"><?php echo $row_dados['produto']; ?></td>

<td>Dispon&iacute;vel</td>

<td><input name=$checkbox" type="checkbox" id="$checkbox" value="<?php echo $row_dados['codponto]; ?>" /></td>

<td><a href="<?php echo $row_dados['imagem']; ?>" target="_blank"><img src="f.png" width="20" height="20" /></a></td>

</tr>

<?php } while ($row_dados = mysql_fetch_assoc($dados)); ?>

</table>

<br />

<input name="txtassunto" type="hidden" id="txtassunto" value="<?php echo $txtassunto ?>" />

<input name="txtmsg" type="hidden" id="txtmsg" value="<?php echo $txtmsg ?>" />

<input type="submit" name="button" id="button" value="Enviar" />

<br />

<br />

</form>

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Qual sua dúvida?

Veja o primeiro resultado do Google, pesquisando sobre "php html checkbox".

Um abraço.

Obrigado pela atenção, eu li este artigo, mas como eu poderia enviar? Tenho uma lista gerada de registros tipo tabelas com checkbox ai queria marcar e enviar o resutado por email. No caso deste artigo ele usa input. To meio perdido como fazer!

tem como me ajudar com código fonte? Obrigado!

Link to comment
Share on other sites

  • 0

listar.php

<?php require_once('Connections/conexao.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "master,simples,basico";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "index_guia.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_Hcontrol, $Hcontrol);
$query_info = "SELECT * FROM hcontrol_info";
$info = mysql_query($query_info, $Hcontrol) or die(mysql_error());
$row_info = mysql_fetch_assoc($info);
$totalRows_info = mysql_num_rows($info);

$colname_dados = "-1";
if (isset($_GET['disponivel'])) {
  $colname_dados = $_GET['disponivel'];
}
mysql_select_db($database_Hcontrol, $Hcontrol);
$query_dados = sprintf("SELECT * FROM dados WHERE disponivel = %s AND `pi` = 'sim' ORDER BY local ASC", GetSQLValueString($colname_dados, "text"));
$dados = mysql_query($query_dados, $Hcontrol) or die(mysql_error());
$row_dados = mysql_fetch_assoc($dados);
$totalRows_dados = mysql_num_rows($dados);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
>
<title></title>
</head>

<body>
<table border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
    <td><font color="#000000" class="tex">
      <span style="font-size: 16px"></span></font><span class="titulo"><font color="#000000"><?php echo $_SESSION['MM_Username']; ?></font></span></td>
  </tr>
</table>
<br />
<form action="enviar.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <table border="0" align="center" cellpadding="4" cellspacing="4" class="tabela">
    <tr bgcolor="#000000">
      <td class="titulobranco">Codigo:</td>
      <td class="titulobranco">Endereco:</td>
      <td class="titulobranco">Referenciaa:</td>
      <td class="titulobranco">Localizao:</td>
      <td class="titulobranco">Produto:</td>
      <td class="titulobranco">Selecione:</td>
      <td><img src="f.png" width="20" height="20" /></td>
    </tr>
    <?php do { ?>
    <tr bgcolor="<?php echo $row_dados['cor1']; ?>">
      <td><?php echo $row_dados['codponto']; ?></td>
      <td><?php echo $row_dados['end']; ?></td>
      <td><?php echo $row_dados['ref']; ?></td>
      <td><?php echo $row_dados['local']; ?></td>
      <td bgcolor="<?php echo $row_dados['cor2']; ?>"><?php echo $row_dados['produto']; ?></td>
      <td bgcolor="<?php echo $row_dados['cor2']; ?>"><input name="checkbox" type="checkbox" id="checkbox" value="confirmado" /></td>
      <td><a href="<?php echo $row_dados['imagem']; ?>" target="_blank"><img src="f.png" width="20" height="20" /></a></td>
    </tr>
    <?php } while ($row_dados = mysql_fetch_assoc($dados)); ?>
    <?php $codponto = $_POST["codponto"]?>
  </table>
  <br />
  <table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td><input type="submit" name="button" id="button" value="Enviar" /></td>
    </tr>
  </table>
  </form>
<br />
<p><br />
</p>
</body>
</html>
<?php
mysql_free_result($info);

mysql_free_result($dados);
?>
enviar.php
<?php
$para = "meuemail@meumail.com.br";
$meu = "meuemail@meumail.com.br";
$assunto = "Resultados";
mail ($para,"$assunto",$resultados,"from: $meu");
echo "Mensagem enviada com sucesso!";

?>

dede já agradeço, abraço!

Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...