ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

PHP - I'm havin a brainfart



I've got a huge form which I want to echo out the values of when there's a problem. I'm using
PHP:
<input type="text" name="email" value="<?php echo $backend->email ?>
for example.

But if the form's not submitted, how do I stop it showing the notice of the variable not having a value?

PHP:
function cleanup(){
        if(isset($_GET)){
            foreach($_GET as $key=>$value){
                strip_tags($_GET[$key]);
                mysql_real_escape_string($_GET[$key]);
                $this->$key = $value;
            }
        }
        
        if(isset($_POST)){
            foreach($_POST as $key=>$value){
                strip_tags($_POST[$key]);
                mysql_real_escape_string($_POST[$key]);
                $this->$key = $value;
            }
        }


    }
I need to somehow do something like this, but I have no idea how to get around it easily
PHP:
if(form not submitted){
             give 'this->fieldname' a value of ''
        }
 
lol they'd laugh at me there for being stuck on something so simple. I guess I've just been coding too long today to be able to think of a solution lol
 

KDF

  Audi TT Stronic
You didnt post the full php class which would have helped. Why do you have it check for POST data and GET data ? surely you should specify that in the form tag ?

Ideally you should not use GET, otherwise people can inject their own data in.
 
The get is as some of the details are filled by an email link. I haven't posted all of the class as it wasn't needed for my problem. The form is submitted via post, which is why I needed both. This is all I needed
PHP:
function __get($name) {
        return "";
}
the url will get checked over before 'doing' anything, I'm half way through writing everything to clean, validate, safen, etc the url
 


Top