ALERT in PHP
Solved
snoopy
-
appkech -
appkech -
L'équivalent en PHP d'`alert` en JavaScript est `echo` ou `print`, car PHP est un langage côté serveur et ne peut pas afficher une boîte de dialogue comme le fait JavaScript côté client. Pour simuler un `alert` en PHP, vous devez générer un code JavaScript qui sera exécuté dans le navigateur. Par exemple :
```php
echo "<script>alert('Votre message ici');</script>";
```
```php
echo "<script>alert('Votre message ici');</script>";
```
I didn't actually know that you could use <script> in PHP.
:-)
In this case, the code above generates JavaScript, and it's the JavaScript (client-side, therefore) that generates the alert...
I know, I'm just adding my two cents :D But I think it's important to understand the difference if you're programming in both languages!
Simon