Jump to content

isset/!isset function


telsiin

Recommended Posts

hello everyone

 

I am trying to detriment if a recorder exist in a table. If the record exist then I would like to change the form button from an Insert record to an Update record as well as the form name.

 

now in this specific test I know that the record does exist however my button won't change to "Update record "

 

am I using the isset/!isset function correctly or should I be using a different function

 

as Always thank to in advance

 

 

 

 

if(!isset($row_Recordset1['CharID']))

{

$val="Insert record";

$nam="MM_insert";

 

if(isset($row_Recordset1['CharID']))

{

$val="Update record";

$nam="MM_update";

 

 

  <td nowrap align="right"> </td>

        <td><input type="submit" value="<?php echo $val; ?>"></td>

  </tr>

  </table>

  <input type="hidden" name="<?php echo $nam; ?>" value="form1">

  <input type="hidden" name="CharID" value="<?php echo $row_Recordset1['CharID']; ?>">

</form>

Link to comment
Share on other sites

You forgot the closing right curly braces:

 

if(!isset($row_Recordset1['CharID']))

{

$val="Insert record";

$nam="MM_insert";

}

 

if(isset($row_Recordset1['CharID']))

{  

$val="Update record";

$nam="MM_update";

}

 

or can be written like:

 

if(isset($row_Recordset1['CharID']))

{  

$val="Update record";

$nam="MM_update";

} else {

$val="Insert record";

$nam="MM_insert";

 

}

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.