Défis lors de l'utilisation de window.location.href pour rediriger vers une nouvelle page
P粉523335026
P粉523335026 2024-04-04 12:57:06
0
1
544

J'ai du mal à rediriger vers un fichier php de domaine local, je suis prêt à rediriger vers quelque chose appelé merci.php Y a-t-il quelque chose qui me manque dans le code qui me permettrait de faire cela ? J'ai fait beaucoup de recherches sur cette question maintenant et je ne vois aucune différence entre ce que je fais et ce qu'on me conseille de faire.

<?php
    require_once "config.php";

    if($_SERVER["REQUEST_METHOD"] == "POST"){
        $sql = "INSERT INTO FormSubmission (fname, lname, address, email, phone, hname, chname, mstatus, bio)
        VALUES ('".$_POST['fname']."','".$_POST['lname']."','".$_POST['address']."','".$_POST['email']."','".$_POST['phone']."','".$_POST['husband']."','".$_POST['children']."','".$_POST['marstat']."','".$_POST['comment']."')";
        if(mysqli_query($link, $sql)===TRUE){
            header("Location: thankyou.php");
        }
        else {
            echo "Error: " . $sql . "<br><br>" . $link->error;
        }

    }
?>
<div id="nav-bar">
        
</div>
<script>
    $(function(){
    $("#nav-bar").load("nav.php");
    });
</script>
<h1>Application for Membership</h1>
<form method="post" formtarget="_blank">
    <label for="fname">First name:</label>
    <input type="text" id="fname" name="fname">
    <br><br>
    <label for="lname">Last name:</label>
    <input type="text" id="lname" name="lname">
    <br><br>
    <label for="address">Address:</label>
    <input type="text" id="address" name="address">
    <br><br>
    <label for="email">Email:</label>
    <input type="text" id="email" name="email">
    <br><br>
    <label for="phone">Phone Number:</label>
    <input type="text" id="phone" name="phone">
    <br><br>
    <label for="husband">Husband's Name: (if applicable)</label>
    <input type="text" id="husband" name="husband">
    <br><br>
    <label for="children">Childrens' Names separated with commas: (if applicable)</label>
    <input type="text" id="children" name="children">
    <br><br>

    <label>What is your Marital Status?</label>
    <div class="form-group">
        <input type="radio" id="single" name="marstat" value="Single">
        <label for="single">Single</label>
    </div>
    <div class="form-group">
        <input type="radio" id="married" name="marstat" value="Married">
        <label for="married">Married</label>
    </div>
    <div class="form-group">
        <input type="radio" id="widowed" name="marstat" value="Widowed">
        <label for="widowed">Widowed</label>
    </div>
    <div class="form-group">
        <input type="radio" id="divorced" name="marstat" value="Divorced">
        <label for="divorced">Divorced</label>
    </div>
    <div class="form-group">
        <input type="radio" id="separated" name="marstat" value="Separated">
        <label for="separated">Separated</label>
    </div>
    <br><br>
    <label>Provide a Brief (500 word) Spiritual Biography</label>
    <br><br>
    <label>Checklist of Points:</label>
    <div class="form-group">
        <input type="checkbox" id="q1" name="q1" value="q1">
        <label for="q1">Why do you want to be part of this society?</label><br><br>
    </div>
    <div class="form-group">
        <input type="checkbox" id="q2" name="q2" value="q2">
        <label for="q2">How do you see the power of beauty working in your life?</label><br><br>
    </div>
    <div class="form-group">
        <input type="checkbox" id="q3" name="q3" value="q3">
        <label for="q3">What do you do to live a life of modesty?</label><br><br>
    </div>
    <div class="form-group">
        <input type="checkbox" id="q4" name="q4" value="q4">
        <label for="q4">Where can you grow in showing maternal love to others?</label><br><br>
    </div>
    <div class="form-group">
        <input type="checkbox" id="q5" name="q5" value="q5">
        <label for="q5">Write out your daily, weekly, monthly and annual prayer schedule.</label><br><br>
    </div>
    <div class="form-group">
        <input type="checkbox" id="q6" name="q6" value="q6">
        <label for="q6">Explain your personal apostolic commitment.</label><br><br>
    </div>
    <textarea rows="6" cols="70" name="comment" placeholder="Enter text here..." style="color:#111"></textarea>
    <h2 class="makewhite">Pledge of Commitment</h2>
    <h3>I, <input type="text" id="fullname" name="fullname"> , being drawn by Almighty God and seeking to live the gift of my femininity more
        fruitfully in the heart of the Catholic Church, voluntarily enroll myself in the Society of Saint
        Lydia. I pledge to be faithful the principals of this Society. I pledge myself to live a life of
        modesty, beauty, and maternity. I pledge to live a life of devout and intimate prayer, being
        faithful to my spiritual commitments. I pledge to live a life of service to the Church and to
        others, being faithful to my apostolic commitments. I pledge to wear the prayer shawl as a
        public witness to my commitment and to share with others about they Society. I will faithfully
        pray for the other members of the society and for the Church.
    </h3>
    
    <input type="submit" value="Submit" />
    <br/>
    
    
</form>

P粉523335026
P粉523335026

répondre à tous(1)
P粉068486220

Vous ne soumettez rien en réalité, alors utilisez simplement l'étiquette du bouton et débarrassez-vous des éléments de retour vrais. Onclick ne peut être que location="quelque chose".

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!