2014-04-01 12:35


  • php

I have searched a lot but can't find my solution. I am new to php so I hope I can explain my question clearly.

I am trying to build a system that allows the user to update his/her information. There are some inputs in the form which are; username, email, old-new password...

What I want to achieve is updating only the changed inputs. (blank inputs will be ignored)

So I want the username input to be checked if it is blank and keep the process working regardless of the result if username is blank or not. By that way ı can update the table with only changed/typed inputs.

How can I achieve that?

if($username != "") {
    //update the username
// keep process going even if username condition is true.
if($email != "") {
    // update the email

PS: I didn't write the whole codes because there are at least 10 inputs and 3 selects. I tried lots of nested if,elseif,else statements so the codes I tried is so complicated and long.

I just wonder If there is a way to keep the process going after an "if statement" even if the condition is true.


I tried using just ifs, I was expecting the process will be continue but, for example;if I left blank the username and type the email, it updates the email.But if username input was typed and the email was typed; it just updates the username.

What could be the problem ?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享