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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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