• Resolved voidingnixx

    (@voidingnixx)


    So WordPress as we all know, updates quite a bit. One of the updates seemed to have broken some of my custom code. Really simple stuff, but something no longer works. I am not a coder and not quite sure what is wrong. Anyone care to tell me what has changed so I can fix this no longer working code? Thanks!

    My page code for the form is this…

    <form action="https://www.websitehere.com/forwarder.php" method="post"><p>
    <input name="lname" type="text" pattern="[a-zA-Z]{2,25}" placeholder="Input Last Name" title="Please Enter Last Name" required style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Last Name</b><br>
    <input name="snumber" type="text" pattern="[0-9]{1,7}" placeholder="Input Street Number" title="Please Enter Numeric Street Number" required style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Street Number</b><br>
    <input name="sname" type="text" pattern="[a-zA-Z]{2,25}" placeholder="Input Street Name" title="Please Enter Alphabetical Street Name" required style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Street Name</b><br>
    <input name="zcode" type="text" pattern="[0-9]{5}" title="Please Enter Zip-code" placeholder="Input Five Digit Zip-code" required style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Zipcode</b><br>
    <input name="month" type="text" pattern="[0-1]{1}[0-9]{1}" min="01" max="12" title="Please Enter Two Digit Month" placeholder="Input Two Digit Month" required style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Month Of Session</b><br>
    <input name="year" type="text" pattern="[0-9]{2}" min="00" max="99" title="Please Enter Two Digit Year" placeholder="Input Two Digit Year" required style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Year Of Session</b><br>
    <input name="session" type="text" pattern="[0-9]{1,2}" title="Leave blank unless you have had multiple sessions during the same month." placeholder="(Leave blank unless needed.)" style="background-color: white; border: 1px solid orange; width:222px;"> : <b>Session Number</b><br>
    <input type="submit" style="font-size:10pt;color:black;background-color:orange;border:2px solid #000000;padding:3px"> - <button type="reset" value="Reset" style="font-size:10pt;color:black;background-color:orange;border:2px solid #000000;padding:3px">Clear</button>
    </form>

    and my php file has this lil’ bit of code…

    <?php 
    $lname = $_POST['lname'];
    $snumber = $_POST['snumber'];
    $sname = $_POST['sname'];
    $zcode = $_POST['zcode'];
    $month = $_POST['month'];
    $year = $_POST['year'];
    $session = $_POST['session'];
    header("Location:https://www.websitehere.com/dir/$lname$snumber$sname$zcode$month$year$session");
    ?>

    It use to work, and directed people to custom urls dependent on the information they entered into the form. However, it now neglects all the variables and only forwards to the domain of https://www.websitehere.com/dir/.

    Since this use to work splendidly, my only guess is that one of the wordpress updates has changed something… I just don’t know what. Any help would be great!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi voidingnixx

    It looks like there is something wrong with the expansion of the variables inside the double quotes of the header string.

    You could try adding and concatenating the variables one by one like this.

    header( 'Location:https://www.websitehere.com/dir/' . $lname . $snumber . $sname . $zcode . $month . $year . $session )

    kind regards

    Thread Starter voidingnixx

    (@voidingnixx)

    Thank you for that response, wpaart.

    I have made the change in code which you suggested. Unfortunately, it still ignores all the variables in the header and only forwards to the URL of https://www.websitehere.com/dir/. If you have any other ideas I can try out, please let me know.

    Hi voidingnixx

    I just tried out your original code in a test environment. It worked as it redirected to an url like this: https://www.websitehere.com/dir/jones4sesamystreet159870417

    Maybe the ‘websitehere.com’ server has some rules in place that make that interfere with your redirection.

    Have you tried to paste a redirect url in your browser like https://www.websitehere.com/dir/jones4sesamystreet159870417 that you know to work?

    Thread Starter voidingnixx

    (@voidingnixx)

    wpaart, thank you for testing that out.

    I just found out it was an error on my part. I recently updated the site for SSL but neglected to change the URL’s to reflect that. It seems I had to change the URL’s from HTTP to HTTPS. The URL’s still being HTTP did not redirect to the correct URL but upon changing them, everything works fine.

    Sorry for wasting your time.

    • This reply was modified 6 years, 11 months ago by voidingnixx.

    Glad to hear you got things working again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP Update – Form Post Fix – Help’ is closed to new replies.