Register in the database and process this data on the same page after registration

Asked

Viewed 431 times

1

I have to make a script that when I put the email in the textarea it registers in the database and automatically after the registration it starts running the script that pulls the images through the email.

I’ve already done the save part in the bank and check the photo by email , but I have to enter the link register.php and then take.php.

I wanted to make a way that when registering the mailing list it automatically called the file picks.php and displays the results on the page according to the database record without having to leave the page.

I want to do everything on a single page: sign up and automatically after the registration to the bank it run the script without leaving the page.

Follows the code:

    <?php

session_start();

if( $_SERVER['REQUEST_METHOD']=='POST' ) {

  $hash = md5( implode( $_POST ) );

  if( isset( $_SESSION['hash'] ) && $_SESSION['hash'] == $hash ) {

    // Refresh! Não faz nada ou re-exibe o formulário preenchido

  } else {

    $_SESSION['hash']  = $request;

    // Submissão legítima! Insere ;)
  }
}

?>


<!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=utf-8" />
  <title>By WeeennderT -</title>
  <style type="text/css">
  .x {
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 12px;
    color: #333;
  }
  </style>
</head>

<body>
  <form id="form1" name="form1" method="post" action="s1.php">
    <p>
      <label for="x"></label>
      <textarea name="x" id="x" cols="150" rows="5"></textarea>
    </p>
    <p class="x">Os dados devem esta dessa forma email:senha<br />
    </p>

    <p>
      <input type="submit" name="button" id="button" value="Enviar" />
    </p>
  </form>
</body>
</html>


    <?php
ini_set('display_errors', 0);
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
  die('Não conseguiu conectar' . mysql_error());
}

$db_selected = mysql_select_db('painel_central', $link);
if (!$db_selected) {
  die ('Não pode selecionar o banco ' . mysql_error());
}

if ($_POST) {
$x = $_POST ['x'];
$erro = 0;
if (empty($x)) {

  echo "Por favor, adiciona sua lista.";

}
foreach (explode("\n", $x) as $item)
{
  $x = explode(":", $item);

}

$sql = mysql_query("INSERT into mercadolivre(login,senha) VALUES ( '".$x[0]."', '".$x[1]."');") or die(mysql_error());
mysql_query($sql);

}

// 
?>

after inserting I want to call the page that tests the values whether it was logged in or not.

  • try to use a direct redirect to the handle page.php?= iddaultimacasdastrada

  • 1

    is a little vague, could post your code and elaborate better your problem ?

  • I edited my question , what I want and after entering the record in texarea it automatically already go to the page where to return the return of the login cadatrado in the database , I want to do without the user leaving the page of the form if I Open the direct page after inserting works , more I want that after I inserted already automatic call.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.