close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

email redirect and mod rewrite pages

Thread began 3/06/2019 7:27 am by Jamie | Last modified 3/06/2019 10:52 am by Ray Borduin | 438 views | 5 replies |

Jamie

email redirect and mod rewrite pages

Hi Ray

Have got a contact form set up which redirects to itself on both validation fail and success...this is fine on a static page but on a dynamic mod rewritten page, it doesnt redirect to the mod rewritten value but the actual filename itself.

If I echo SERVER_URI to the page it shows the mod rewritten value but the redirect doesnt.

the validation is

<?php 
if (isset($_POST["ContactForm"]) || isset($_POST["ContactForm_x"])) {
$WAFV_Redirect = "".$_SERVER['REQUEST_URI'] ."#validfail";
$_SESSION['WAVT_contactform_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ((isset($_POST["Name"])?$_POST["Name"]:"") . "",true,1);
$WAFV_Errors .= WAValidateRQ((isset($_POST["Telephone"])?$_POST["Telephone"]:"") . "",true,2);
$WAFV_Errors .= WAValidateEM((isset($_POST["Email_Address"])?$_POST["Email_Address"]:"") . "",true,3);
$WAFV_Errors .= WAValidateRX(((isset($_POST["emailx"]))?$_POST["emailx"]:"") . "","/^$/i",false,4);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Area_of_Interest"]))?$_POST["Area_of_Interest"]:"") . "",false,5);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"contactform");
}
}
?>



and the email side of things is

<?php
if (isset($_POST["ContactForm"]) || isset($_POST["ContactForm_x"])) { //WA Universal Email
$Email = new WA_Email("waue_sayhello_1");
$Email->Redirect = "".$_SERVER['REQUEST_URI'] ."?sent=1&#success";
$Email->From = "College Chambers <noreply@motley.site>";
$Email->Importance = "1";
$Email->BurstSize = "200";
$Email->BurstTime = "1";
$Email->WaitTime = "1";
$Email->addTo("jamie@motley.co.uk");
$Email->BodyFile = "webassist/email/templates/Blank.php";
if (function_exists("rel2abs") && $Email->Redirect) $Email->Redirect = $Email->Redirect?rel2abs($Email->Redirect,dirname(__FILE__)):"";
for ($emailGroup=0; $emailGroup<sizeof($Email->To); $emailGroup++) {
$Email->Subject = "Website Enquiry";
$Email->send($emailGroup);
}
$Email->close();
}
?>



Have put a link to a mod rewritten page in the PM and if you scroll down you will see the form on the page

TIA

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

The issue appears to be the form action. I think if you remove the action from the form it will automatically use the URI.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

thanks Ray. the failed validation sort of works but it appends ?perm=news-article-4 so that it looks like

college/article/news-article-4#validfail?perm=news-article-4



unfortunately, the success redirect still isnt working and still redirects to the actual filename

Sign in to reply to this post

Ray BorduinWebAssist

Can I get FTP access? I'll take a look.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

sure thing. have attached the setup file. All the contact form elements are in a folder called 'contact' within the includes folder

Sign in to reply to this post

Ray BorduinWebAssist

On the page:
/includes/contact/send_email.php on line 4 you have:
$Email->Redirect = "".$_SERVER['PHP_SELF'] ."?sent=1&#success";

That should be:
$Email->Redirect = "".$_SERVER['REQUEST_URI'] ."?sent=1&#success";

I updated the file:
/webassist/form_validations/wavt_scripts_php.php

I made it so that it won't append a url parameter if the link has a hash "#" in it. That should fix the failed redirect issue. You will want to back that file up so you don't accidentally replace it later since it will be re-generated when you update or add server validations.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...