prepare($sql); $stmt->bindParam(':song_name', $songName); $stmt->bindParam(':artist_name', $artistName); $stmt->bindParam(':reason', $reason); $stmt->bindParam(':user_id', $userIdentifier); $stmt->execute(); // 跳转回主页并显示成功消息 header('Location: index.html?status=success'); exit; } catch(PDOException $e) { // 数据库错误 header('Location: index.html?status=error&msg=' . urlencode($e->getMessage())); exit; } } else { // 字段验证失败 header('Location: index.html?status=error&msg=歌曲名称和歌手名称为必填项'); exit; } } else { // 非POST请求直接跳转回主页 header('Location: index.html'); exit; } ?>