Treaktors Posted May 11, 2018 Report Share Posted May 11, 2018 Sveiki! Uztaisīju uz ātro reģistrācijas formu tikai e-pastam, no sākuma gāja bet tad kaut kas nobeidzas un datubāzē e-pasta vietā rādās cipars 1 vai vispār neaizsūtās, ir kāds variants kas varētu būt pa kļūdu? kods: <?php require('connect.php'); // If the value are posted, insert them into the database. $email = isset($_POST['email']); $query = "INSERT INTO `user` (email) VALUES ('$email')"; $result = mysqli_query($connection, $query); if($result){ $smsg = "Veiksmīgi reģistēts"; }else{ $fmsg ="Reģistācijas kļūda"; } ?> <html> <head> <title>User Registeration Using PHP & MySQL</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" > <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" > <link rel="stylesheet" href="styles.css" > <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <form class="form-signin" method="POST"> <?php if(isset($smsg)){ ?><div class="alert alert-success" role="alert"> <?php echo $smsg; ?> </div><?php } ?> <?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?> <h2 class="form-signin-heading">Please Register</h2> <div class="input-group"> <input type="text" name='email' class="form-control" placeholder="E-Pasts" required> </div> <div class="checkbox"><input type="checkbox" required name="checkbox" value="check" id="agree" /><a href="policy.php">Es esmu izlasījis un piekrītu privātuma politikai</a> </label> </div> <button class="btn btn-lg btn-primary btn-block" type="submit">Apstiprināt</button> </form> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Caaliitis Posted May 11, 2018 Report Share Posted May 11, 2018 Quote $email = isset($_POST['email']); $query = "INSERT INTO `user` (email) VALUES ('$email')"; http://php.net/manual/en/function.isset.php Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 11, 2018 Author Report Share Posted May 11, 2018 izlaboju bet nav vienalga Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 11, 2018 Author Report Share Posted May 11, 2018 Just now, Treaktors said: izlaboju bet nav vienalga datubāzi veidoju pēc šāda CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `email` varchar(255) NOT NULL, `active` tinyint(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`) ) Quote Link to comment Share on other sites More sharing options...
daGrevis Posted May 11, 2018 Report Share Posted May 11, 2018 Kā tu izlaboji? Patreiz izskatās, ka isset rezultāts, boolean, tiek ierakstīts datubāzē un konvertēts uz text reprezentāciju, kas būtu "1". Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 11, 2018 Author Report Share Posted May 11, 2018 5 minutes ago, daGrevis said: Kā tu izlaboji? Patreiz izskatās, ka isset rezultāts, boolean, tiek ierakstīts datubāzē un konvertēts uz text reprezentāciju, kas būtu "1". ''text'' nomainīju uz ''email'' Quote Link to comment Share on other sites More sharing options...
ieleja Posted May 11, 2018 Report Share Posted May 11, 2018 1 hour ago, Treaktors said: $email = isset($_POST['email']); Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 11, 2018 Author Report Share Posted May 11, 2018 Atrisināts, pieliku ? trim($_POST['email']):""; un viss aizgāja Quote Link to comment Share on other sites More sharing options...
daGrevis Posted May 11, 2018 Report Share Posted May 11, 2018 Quote Link to comment Share on other sites More sharing options...
Kasspars Posted May 11, 2018 Report Share Posted May 11, 2018 Nu bet galvenais, ka darbojas :D Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 11, 2018 Author Report Share Posted May 11, 2018 Tikai tagat rodas jautājums kā panākt to ka reģistrētajam e-pastam nosūta apstiprinājuma ziņu? Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 11, 2018 Author Report Share Posted May 11, 2018 3 hours ago, daGrevis said: Nedaudz jā, mācos tikai, bet kautkā jau viss izdodas Quote Link to comment Share on other sites More sharing options...
Caaliitis Posted May 11, 2018 Report Share Posted May 11, 2018 (edited) ieraksti google "php send mail" un tev uzreiz izspļauj http://php.net/manual/en/function.mail.php Tur arī viss skaidrā angļu valodā rakstīts, kā arī tiek piedāvati piemēri. Sāc ar Google search pamatu apgūšanu. Edited May 11, 2018 by Caaliitis Quote Link to comment Share on other sites More sharing options...
Treaktors Posted May 14, 2018 Author Report Share Posted May 14, 2018 On 5/11/2018 at 4:03 PM, Caaliitis said: ieraksti google "php send mail" un tev uzreiz izspļauj http://php.net/manual/en/function.mail.php Tur arī viss skaidrā angļu valodā rakstīts, kā arī tiek piedāvati piemēri. Sāc ar Google search pamatu apgūšanu. Paldies! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.