Note that there are some explanatory texts on larger screens.

plurals
  1. POUndefined index with session
    primarykey
    data
    text
    <p>I'm developing a chatbox script, and I have this page that checks if session is set, and if so, the certain elements of code should be hidden with jQuery. Here are my pages:</p> <p>input.php: </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; &lt;style type="text/css"&gt; @import "stil.css"; &lt;/style&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;script type="text/javascript" src="jq.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-ui-1.8.13.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="postme.js"&gt;&lt;/script&gt; &lt;?php include_once('check.php'); ?&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrap"&gt; &lt;div id="chat"&gt; &lt;div id="main"&gt; &lt;/div&gt; &lt;div id="input"&gt; &lt;form name="form"action="test.php" method="post"&gt; &lt;input type="text" name="tekst" id="msg" size="72" /&gt; &lt;input type="submit" name="dugme" value="posalji" id="dugme" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="black"&gt; &lt;/div&gt; &lt;div id="name"&gt; &lt;form name="yname"&gt; &lt;input type="text" name="tekst2" /&gt; &lt;input type="button" name="dugme2" value="Enter" onclick='send()' /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>sesion.php:</p> <pre><code>&lt;?php session_start(); $_SESSION['ime']=$_POST['ime']; $sesion_n=$_SESSION['ime']; echo $sesion_n; ?&gt; </code></pre> <p>check.php:</p> <pre><code>&lt;?php include('sesion.php'); if (!isset($sesion_n)){ echo "&lt;script type='text/javascript'&gt;$('#black').hide();$('#name').hide();&lt;/script&gt;"; } ?&gt; </code></pre> <p>postme.js:</p> <pre><code> function send(){ $.post('sesion.php',{ime:yname.tekst2.value},function(val){ if(val!=null) { $('#black').fadeOut(); $('#name').hide(); alert(val); } } )}; </code></pre> <p>So the problem is that I get this error every time I run the page: Notice: Undefined index: ime in C:\wamp\www\AJAX\sesion.php on line 3.<br> So can someone tell me what I'm doing wrong here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload