Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM Form submit leads to index.php, no data submitted
#1
Hi everyone,
I'm finishing up the implementation of my first website into GS. Smile

Unfortunately my contact form is no longer working. When I click submit - with our without entering any data - I'm sent to index.php. I have form validations with JavaScript and PHP, but they just get skipped. 

So I'm thinking something about how the form action field is set up may be the cause for this, but I could be wrong. I've made websites before, but I'm pretty new to CMSs.

I've been using this for the website without GS implementation:
<form id="form1" class="form" name="contactForm_1" 
  action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="POST">

In GS, I tried this:
<form id="form1" class="form" name="contactForm_1" 
  action="<?php get_page_url(); ?>" method="POST">

But I'm still sent back to index.php and the mail doesn't get sent. I'm using try/catch in my code and have turned on error reports, but I'm not getting any displayed.

After submitting the data, my code is supposed to load a message-sent page, like so:
header('Location: message.php');
I'm pretty sure I will have to alter this for GS as well.

I would appreciate some help.

EDIT: 
I've been searching high and low, but like 10 minutes after I post this, I find ($_SERVER['QUERY_STRING']). That solves the first issue. I did not know QUERY_STRING is a thing. 

EDIT 2:
And lastly header('Location: index.php?id=message-sent'); worked out for redirecting the page.

Oh well Rolleyes  Maybe my post helps someone, somewhere, eventually. 
Reply




Users browsing this thread: 1 Guest(s)