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
https://forums.phpfreaks.com/topic/90768-issetisset-function/
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
https://forums.phpfreaks.com/topic/90768-issetisset-function/#findComment-465273
Share on other sites

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.