Jump to content

How to put a conditional within a loop what a user has entered


j.smith1981

Recommended Posts

I am trying to trim the values of a $_POST array like so:

 

<?php	  if(array_key_exists('register', $_POST)) {
    
	foreach($_POST as $value) {
	  trim($value);
	}
  }

 

But then seeing if I can use another loop to see if anything has actually been entered, how would I go about doing this?

 

Keep thinking of a better way of doing this but I am not too sure how.

 

Any help's appreciated,

Jeremy.

Ahh that's wonderful.

 

Will have a crack with that, to see what else I can do with it, wonderful thank you so much.

 

Really have to say this is the most impressive forum I have ever been on for PHP tips and tricks.

 

I like the way within a few hours in the afternoon someone will reply with a good example of what to do and explaining a reason for this, if it seems quite confusing but those to me look very interesting.

 

Love the way I am trying to go for more maintainable code, using a reference from memory of a book I have been reading on PHP and trying the examples out for myself.

 

Thanks again,

Jez.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.