Black Friday! Get up to 25% off GP Premium! Learn more ➝

[Resolved] HTML form $_POST problem

Home Forums Support [Resolved] HTML form $_POST problem

Home Forums Support HTML form $_POST problem

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #316301

    I use a shortcode with the following PHP code on a page:

     function email_bereitstellen() {
    	$id = $_POST["id"];
    	$conn = mysqli_connect('', 'U2884970', 'RISSim2017', 'DB2884970');
        // Check connection
    	if ($conn->connect_error) {
    		die("Verbindungsfehler: " . $conn->connect_error);
    	$query = "SELECT name, vorname, email FROM wp_gremien WHERE Id=$id";
    	$result = mysqli_query ($conn, $query);
    	if ($result!= TRUE) {
        	echo "Error: " . $query . "<br>" . $conn->error . '<br>';
    	} else {
    		$row = mysqli_fetch_assoc($result);
    		$name = iconv('ISO-8859-1', 'UTF-8', $row["name"]);
    		$vorname = iconv('ISO-8859-1', 'UTF-8', $row["vorname"]);
    	    $email = $row['email'];
    		$name = $vorname . ' ' . $name;
    		echo '<h2>Gremienmitglied: ' . $name . ' ('. $email . ')</h2>';
    	<form action=""><button style="padding: 10px;" type="submit">falsche ID</button></form>
    		echo '<br><h3>E-Mail Adresse für Bürger/innen freischalten/löschen?</h3>';
    	<form action="" method="post">
    		<input type="radio" name="schalten" value="freischalten" checked> freischalten<br>
    		<input type="radio" name="schalten" value="loeschen"> löschen<br>		
    		<input type="hidden" value="
    <?php	echo $name; ?>" name="name">
    		<input type="hidden" value="
    <?php	echo $email; ?>" name="email">
    		<input type="hidden" value="
    <?php	echo $id; ?>" name="id">
    		<br><p><input type="submit" value="Verarbeiten"></p>
    add_shortcode('email-bereitmachen', 'email_bereitstellen');

    When the action is invoked I get a 404 error. In the URL line the correct page is shown and when I click on edit page the page to be invoked is shown.

    When I delete a hidden input line everything is okay. Then the correct page is invoked.

    What may be the reason of the problem?

    Another example:

    function email_senden() {
    <h2 style="margin-bottom: 20px !important;">Ihre E-Mail an Empfänger</h2>
    <form action="" method="post">Mein Name <span style="color: red;">*</span>
    <input name="name" required size="40" type="text" />
    Meine E-Mail <span style="color: red;">*</span>
    <input name="email" required size="40" type="email" />
    <input name="betreff" size="40" type="text" />
    Nachricht <span style="color: red;">*</span>
    <textarea cols="30" name="nachricht" required rows="10"></textarea>
    <input name="empfaenger" type="hidden" value="" />
    <input type="submit" value="Absenden"></form>

    This is only the starting point of a larger code sequence. The effect is just the same: 404 and correct URL.

    GeneratePress 1.3.46
    GP Premium 1.2.96
    Lead Developer
    Lead Developer

    Hmm, nothing immediately comes to mind.

    This might be a question for – someone should be able to spot the issue.

    Let me know 🙂


    the solution is simple when you know it:

    name is a forbidden name in the name=”” attribute!

    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.