Bonsoir j'ai un formulaire d'inscription mais je n'arrive pas à passer au compte personnel de la personne inscrite malgrès que j'ai fait une redirection vers "administration.component.html". Comment je peux ajouter un code php dans ce component parce que je veux ajouter les cordonnées de la personne inscrite dans la page administration

Nom : inscri.png
Affichages : 145
Taille : 9,9 Ko

inscription.component.ts

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, FormBuilder, Validators, NgForm } from '@angular/forms';
import { first } from 'rxjs/operators';
import { Router } from '@angular/router';
import { ApiService } from '../api.service';
@Component({
selector: 'app-inscription',
templateUrl: './inscription.component.html',
styleUrls: ['./inscription.component.css']
})
export class InscriptionComponent implements OnInit {
    angForm:FormGroup;
    submitted = false;
    constructor(private fb: FormBuilder,private dataService: ApiService,private router:Router) {
    this.angForm = this.fb.group({
    email: ['', [Validators.required, Validators.email]],
    password: ['', [Validators.required, Validators.minLength(8)]],
    name: ['', [Validators.required]]
    });
    }
ngOnInit() {
}
// convenience getter for easy access to form fields
get f() { return this.angForm.controls; }
postdata(angForm1:any)
{
    this.submitted = true;
    // stop here if form is invalid
    if (this.angForm.invalid) {
        return;
    }
this.dataService.userregistration(angForm1.value.name,angForm1.value.email,angForm1.value.password)
.pipe(first())
.subscribe(
data => {
    const redirect = this.dataService.redirectUrl ? this.dataService.redirectUrl : '/administration';
    this.router.navigate([redirect]);
});
}
 
}
inscription.php
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include_once("database.php");
$postdata = file_get_contents("php://input");
$name = $_POST["name"];
$email = $_POST["email"];
$Password = $_POST["Password"];
 
if(isset($postdata) && !empty($postdata))
{
$request = json_decode($postdata);
$name = trim($request->name);
$pwd = mysqli_real_escape_string($mysqli, trim($request->pwd));
$email = mysqli_real_escape_string($mysqli, trim($request->email));
$sql = "INSERT INTO users(name,password,email) VALUES ('$name','$pwd','$email')";
if ($mysqli->query($sql) === TRUE) {
 
$authdata = [
'name' => $name,
'pwd' => '',
'email' => $email,
'Id' => mysqli_insert_id($mysqli)
];
echo json_encode($authdata);
}
}
?>
merci d'avance