Hi there,

I'm having a bit of a problem passing a variable from a form to a php script and could use some help.

I hope this makes sense: The problem occurs when the script doesn't recognise the name of the text-area (which is a unique name that changes each time). It is unique due to a randomly generated number (which is also passed to the script and working). I've tried using GET methods of passing the $id and also hidden field (POST) methods. The $id is passed both times, but when used to retrieve the text-area content it throws the error:

Notice: Undefined index: editcontent2894864c9b2d11c11a91.56512640 in C:\wamp\www\intergr8\backstage\backstage.php on line 126

here is the 'getNews.php' script:

else if($action=="edit") // EDIT ARTICLE
		while($row = mysql_fetch_array($result))
			$id = uniqid(rand(100000,999999),true); //ckeditor ID
			echo "<br />Edit your article and click confirm to change.<br /><br />";
			echo "<form action='backstage.php?editidnum=".$id."' method='post' enctype='multipart/form-data'>
				<input type='hidden' value='".$id."' name='idvalue' />
                            echo "<tr>";
                            foreach($message as $value)
                                echo "<td colspan='2' class='error'>".$value."</td>";
                            echo "</tr>";
						else if(isset($_GET['success']))
							 echo "<td colspan='2' class='success'>*Thankyou. Your article was successfully posted!</td>";
                        <td><input type='text' name='title'
						echo "/></td>
                        <td><input type='file' name='downloadfile".$id."' /></td>
                        <td colspan='2'><textarea class='textArea' name='editcontent".$id."'>".$row['news_content']."</textarea></td>
                        <td colspan='2' id='alignRight'><input type='image' value='edit' name='edit' src='images/popup_10.png' /><br />
<br />
                <script type='text/javascript'>
                    CKEDITOR.replace( 'editcontent".$id."',
                        width: '840px',
                        height: '260px',
                        toolbar : 'News',

And here is the relevant script from 'backstage.php':

//EDIT post from form
		if(isset($_POST['edit']) && $_POST['edit']=="edit")
			$id = $_GET['editidnum'];
			$downloadPost = 'editdownloadfile'.$id;
			$editContent = "editcontent".$id;
			echo $title = $_POST['title'];
			echo $content = $_POST[$id];	//This line gives an error

I've been working on this problem for hours and hours. And I think it might be something simple for someone else to spot. So any help would be kindly appreciated.



Undefined index means you're referring to an array with an index value that doesn't exist or can't be recognised. Try putting single quotes around the


Hi thanks for the fast reply.

It now gives the error:

Notice: Undefined index: $id in C:\wamp\www\intergr8\backstage\backstage.php on line 126

When I echo

$id = $_GET['editidnum'];

I get an output such as '9414154c9b34d0670fd0.45553279'.

Ignore this post, I didn't think clear enough.

I've fixed it. I took away the uniqueid, leaving the the rand function.

This left the id generated to a 6 digit string rather than the huge one shown earlier (the one when echoing the get request).

For some reason it didn't like the original method.

Thanks all for the help.