I have a customer registration form where it is possible to register one client at a time, how do I register two clients for example at one time using this same form? I tried to put one more input, but only the last record.
form.php
<html>
<head>
<title> Cadastro de Usuário </title>
</head>
<body>
<form method="POST" action="cadastro.php">
<label>Nome:</label><input type="text" name="nome" id="nome"><br>
<label>Sobrenome:</label><input type="text" name="sobrenome" id="sobrenome"><br>
<input type="submit" value="Cadastrar" id="cadastrar" name="cadastrar">
</form>
</body>
</html>
<?php$nome=$_POST['nome'];$sobrenome=$_POST['sobrenome'];$connect=mysql_connect('localhost','root','');$db=mysql_select_db('painel2');$query_select="SELECT nome FROM clientes WHERE nome = '$nome'";
$select = mysql_query($query_select,$connect);
$array = mysql_fetch_array($select);
$logarray = $array['nome'];
if($nome == "" || $nome == null){
echo"<script language='javascript' type='text/javascript'>alert('O campo nome deve ser preenchido');window.location.href='formulario.php';</script>";
}else{
if($logarray == $nome){
echo"<script language='javascript' type='text/javascript'>alert('Esse nome já existe');window.location.href='formulario.php';</script>";
die();
}else{
$query = "INSERT INTO clientes (nome,sobrenome) VALUES ('$nome','$sobrenome')";
$insert = mysql_query($query,$connect);
if($insert){
echo"<script language='javascript' type='text/javascript'>alert('Cliente cadastrado com sucesso!');window.location.href='formulario.php'</script>";
}else{
echo"<script language='javascript' type='text/javascript'>alert('Não foi possível cadastrar esse cliente');window.location.href='formulario.php'</script>";
}
}
}
?>