$query = mysql_query("SELECT * FROM page WHERE ID='$Id'");
$row = mysql_fetch_array($query);
<form style="width:100%" action="" method="post" id="form1">
<table class="viewjob" align="center" >
<tr class="tableheader">
<td align="center" colspan="4"> Update </td>
<tr class="tablerow">
<td>Page Id</td>
<td><select name='PageId' class="select">
<option  value='0' >select any page</option>

$sql10 = "SELECT Id,Title FROM abc";
$rs = mysql_query($sql10) or die(mysql_error());
while($row = mysql_fetch_array($rs)){
$selected = ($val == $row['Id'] ? 'selected="selected"' : '');
echo '<option value ="' . $row['Id'] . '" '. $selected .'>' . $row['Title'] . '</option>';


i am insert and update on the same php page
this code is run in update but the error of Illegal string offset 'PageId' is on insert

if $_GET['Id'] (line 1) is not set, $row['PageId'] (line 27) will no exist

adding this line on the top of coding


That just turns off any error message below E_PARSE level.
It doesnot solve the error.

so how can i do this
if $_GET['Id'] (line 1) is not set, $row['PageId'] (line 27) will no exist
can you please apply and send me

and can you solve my this problem @pzuurveen
Click Here

I didn't give you the solution because you already know it.
isset() will test test if a var exists without giving an error.
Simular as you do on line 1.
empty() whill test if i has a value that is not FALSE
combining the 2:

if( isset($row['PageId']) && !empty($row['PageId']) )   
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.