- This topic has 3 replies, 2 voices, and was last updated 6 years, 11 months ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
May 10, 2017 at 6:53 am #316301Hans
I use a shortcode with the following PHP code on a page:
function email_bereitstellen() { $id = $_POST["id"]; $conn = mysqli_connect('rdbms.strato.de', '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="http://huppenbroich.de/ris/gremien/pflege/"><button style="padding: 10px;" type="submit">falsche ID</button></form> <?php echo '<br><h3>E-Mail Adresse für Bürger/innen freischalten/löschen?</h3>'; ?> <form action="http://huppenbroich.de/ris/email-schalten/" 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> </form> <?php mysqli_close($conn); } } 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="http://huppenbroich.de/ris/email-absenden/" 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" /> Betreff <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="hans@keutgen.com" /> <input type="submit" value="Absenden"></form> <?php } add_shortcode('email-senden','email_senden');
This is only the starting point of a larger code sequence. The effect is just the same: 404 and correct URL.
May 10, 2017 at 7:55 am #316350TomLead DeveloperLead DeveloperHmm, nothing immediately comes to mind.
This might be a question for http://stackoverflow.com/ – someone should be able to spot the issue.
Let me know 🙂
May 11, 2017 at 9:26 am #316780Hansthe solution is simple when you know it:
name is a forbidden name in the name=”” attribute!
May 11, 2017 at 10:18 am #316808TomLead DeveloperLead DeveloperGlad you got it working! 🙂
-
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.