如何在与表单相同的行上显示echo消息?
<form name="form1" method="post" action="">Correo: <input type="text" name="mail"><input type="submit" name="Suscribir" value="Suscribir"></form>
<?php
$email = $_POST['mail'];
//the data
$data = "$email\n";
//open the file and choose the mode
$fh = fopen("users.txt", "a");
fwrite($fh, $data);
//close the file
fclose($fh);
if (count($_POST)>0) echo "Suscripcion dado de alta";
?>
谢谢
答案 0 :(得分:1)
只需将css display:inline
属性放在表单上:
<form style="display:inline-block;">
或者将您的php放入<form>