Beginner - mailer.php issues


#1

Hello everyone!

I keep seeing this error on my website:

Notice: Undefined index: success in /storage/ssd2/028/7379028/public_html/index.php on line 499
Notice: Undefined index: success in /storage/ssd2/028/7379028/public_html/index.php on line 503

I’m clueless!

This is a screenshot of my website:

This is my php code in index.php

        <div class="map"></div>
            
            <div class="form-box" id="form">

                <div class="row">
                    <h2>We're happy to hear from you</h2>
                </div>

                <div class="row">
                    <form method="post" action="mailer-new.php" class="contact-form">

                    <div class="row">
                              
                    <?php 
                        
                    if(isset($_GET['success'])) {
                        
                    if($_GET['success'] == 1) {
                        echo "<div class=\"form-messages success\">Thank You! Your message has been sent.</div>";
                    }
                        
                    if($_GET['success'] == -1) {
                        echo "<div class=\"form-messages error\">Oops! Something went wrong. Please try again.</div>";
                    } 
                    }
                    ?> 
                        
                    </div>

Here is mailer-new.php just in case: https://codepen.io/francesca829/pen/EdNdGg

By the way, should the mailer-new.php go into the public_html folder (along with index.php)?

Thank you very much, I’m really stuck!


#2

Means the “success” variable is not set for $_GET


#3

it may when tha page load the page cannot found any value so display the error, whaever you just wtite this function error_reporting(0) begnning of the code if the page work fine the go on.

error_reporting(0);


#4

I’ve changed a value or two, can you confirm if the error still appear and if you got the contact form submission I put in?

https://developers.google.com/maps/documentation/javascript/error-messages?utm_source=maps_js&utm_medium=degraded&utm_campaign=billing#api-key-and-billing-errors

Also you’ll need to get an API key for your map to correctly function.


#5

Hi, thank you all for your reply, they were much appreciated (and needed!).

@ckhawand
the problem is I’m using a code written by a third party. I don’t know PHP and how to set those variables.

@Infinity
what values did you change???
No error messages now! I still have problems with the footer’s style but I’ll try to fix it on my own.
I didn’t get the contact form but that’s because I’m still using the free account for now. I’m very new here.


#6

I changed the code from mailer.php to mailer-new.php because the file in public_html is called mailer-new.php

I thought it was set to a gmail address I thought it would have sent off okay


#7

:scream::scream: That’s so?
I changed it but not here obviously… :dizzy_face::dizzy_face:

About the mail: I don’t know if this is the case, but while looking for a solution I spotted this video:

where the guy explains that gmail doesn’t work and how to work around this problem.

Thank you very much!


#8

Mailer seems to be working fine on your site :slight_smile:

Check your gmail / spam!


#9

Wow, you’re right. It’s there! :rofl:
Again: thank you sooo much! :pray: