close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

form action bypassing page I want

Thread began 12/17/2019 10:44 am by JBWebWorks | Last modified 12/17/2019 6:39 pm by Ray Borduin | 440 views | 4 replies |

JBWebWorks

form action bypassing page I want

I have product pages and at the bottom of each bottom page, There is a submit button with action to go to a quote request page. This is the action:
<form action="quote_form.php?pdf_ID=60" method="post" id="form1">
<input name="submit1" type="image" id="submitimg" src="images/quote.jpg" alt="Request Quote" />
On the quote_form.php page I have a form and a recordset with a GET variable to receive the ?pdf_ID=60 and the recordset populates a menu list from the pdf_ID.
The form should send an email with the person's info and the product that they want a quote. The email redirect to ?success=true which would show a message on the page that the email has been sent.
I recently upgraded this page to the most recent webassist email version and now when the form action button on the product page is pressed it bypasses the quote form page and goes directly to the ?success=true and no email is sent?
Code from the quote_form.php

<?php require_once("webassist/form_validations/wavt_scripts_php.php"); ?>
<?php require_once("webassist/form_validations/wavt_validatedform_php.php"); ?>
<?php require_once('Connections/connsqli.php'); ?>
<?php
if (($_SERVER["REQUEST_METHOD"] === "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) {
$WAFV_Redirect = "";
$_SESSION['WAVT_quoteform_591_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["name1"]))?$_POST["name1"]:"") . "",false,1);
$WAFV_Errors .= WAValidateEM(((isset($_POST["email1"]))?$_POST["email1"]:"") . "",true,2);
$WAFV_Errors .= WAValidatePN(((isset($_POST["phone1"]))?$_POST["phone1"]:"") . "",true,false,true,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["company1"]))?$_POST["company1"]:"") . "",false,4);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["quote_model"]))?$_POST["quote_model"]:"") . "",false,5);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["message1"]))?$_POST["message1"]:"") . "",false,6);
$WAFV_Errors .= WAValidateLE(strtolower(((isset($_POST["Security_Code_1"]))?$_POST["Security_Code_1"]:"")) . "",strtolower($_SESSION['captcha_Security_Code_1']) . "",true,7);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"quoteform_591");
}
}
?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$rs_kaeser = new WA_MySQLi_RS("rs_kaeser",$connsqli,0);
$rs_kaeser->setQuery("SELECT * FROM kaeser_models WHERE pdf_ID = ?");
$rs_kaeser->bindParam("i", "".$_GET['pdf_ID'] ."", "-1"); //var1
$rs_kaeser->execute();
?>
<?php require_once("webassist/email/WA_Email.php"); ?>
<?php
if (isset($_POST["submit1"]) || isset($_POST["submit1_x"])) { //WA Universal Email
$Email = new WA_Email("quote_form_2");
$Email->Redirect = "?success=true";
$Email->From = "".((isset($_POST["name1"]))?$_POST["name1"]:"") ." <".((isset($_POST["email1"]))?$_POST["email1"]:"") ."";
$Email->addTo("joef@airpowerservicesinc.com");
$Email->addTo("jb@jbwebworks.com");
$Email->BodyFile = "webassist/email/waue_quote_form_1_body.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 = "Quote Request from the website";
$Email->send($emailGroup);
}
$Email->close();
}
?>
Sign in to reply to this post

Ray BorduinWebAssist

If it is going to the success page, that means it is trying to send the email. That means the issue is that you aren't receiving the email. One potential issue is your FROM address is set to come from the form. You shouldn't do that. Many email servers will reject emails that come FROM somewhere other than the actual email server that sends it.

You should probably set the from to a valid email address from your server like: "jb@jbwebworks.com"

Then you can set the Reply To address to the email address from the form so that you can still reply to the individual. I'd also update the server validations to use the same trigger as the email. Also the server validation redirect should go back to the form page where the values were filled out.

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

JBWebWorks

Ray,
I changed that and it did send the email but it was empty because the page where the form is is being bypassed.
See example here
https://www.airpowerservicesinc.com/mako4.php click the submit button bottom of page (action is https://www.airpowerservicesinc.com/quote_form.php?pdf_ID=63) which I want to go to the page so the person can fill out the form. But it bypasses that page and goes to https://www.airpowerservicesinc.com/quote_form.php?success=true which is after the email is sent and redirects.

Sign in to reply to this post

Ray BorduinWebAssist

Please attach a copy of both pages.

Most likely you are using the same submit form element button name on both pages. You probably just have to update the submit button name on one of the pages to make sure they are unique (probably on the first page so you don't have to update the triggers).

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

JBWebWorks

That was it; can't believe that I didn't think of that.....I bet you have heard that before.
Thanks and Merry Christmas, Ray!

Sign in to reply to this post

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...