PHPstorm $_POST not working


  I just started using PHPStorm with WAMP and everything was working fine until I tried to create a simple form. I know about isset, but when I set that, it was never defined. I am very confused. The code is below:

* Created by PhpStorm.
* User: njden_000
* Date: 2/11/2015
* Time: 12:27 PM
    $servername = "localhost";
    $username = "root";
    $password = "";
    $fileSaved = False;
    $conn = mysqli_connect($servername, $username, $password);
        die("Trouble connecting to server");
    else {
        echo "success";
        $strAttr  = 0;
        if(isset($_POST['str'])){ $strAttr = $_POST['str']; }
       # $conAttr = $_POST['con'];
       # $wisAttr = $_POST['wis'];
       # $intelAttr = $_POST['int'];
       # $chaAttr = $_POST['cha'];
       # $agiAttr = $_POST['agi'];
        echo $strAttr;
        $fileSaved = True;


<p>It's time to create your character! Name your player and click roll to see what stats they have.</p><br />
<textarea id="nameAttr" rows="1" cols="15" maxlength="15" style="overflow:hidden; resize:none"></textarea><br />
<form action="saveConfig.php" method="post">
<p >Strength: </p><p id="strAttr" name="str" >0</p><br />
<p>Constitution: </p><p id="conAttr" name="con">0</p><br />
<p>Wisdom: </p> <p id="wisAttr" name="wis">0</p><br />
<p>Intelligence: </p><p id="intAttr" name="intel">0</p><br />
<p>Charisma: </p><p id="chaAttr" name="cha">0</p><br />
<p>Agility: </p><p id="agiAttr" name="agi">0</p><br />

<button onclick="rollAttr()">Roll</button><br /> <!-- The javascript functions work fine -->
Comment actions Permalink

Hard to tell without the javascript here to see how you are submitting the form.

Do you have xdebug enabled on your Wampserver? If so, which Superglobals are showing up?

Comment actions Permalink

There isn't any javascript that sends the info, the form action is supposed to do that with the method and action attributes after I press continue button. It loads the php perfectly, I echoed a "hello world" and that worked, but it doesn't send the str information. Anyone know why? What's xdebug? I don't have that enabled. I"m a beginner with all this stuff.

Comment actions Permalink

If there's nothing submitting from the javascript, I don't think your form is submitting, which is why you're not seeing any values.

Try instead

<button type="submit" />

if that doesn't work, try a simple input submit, but I think either should do the trick.

<input type="submit" />

See if this give you better luck.


XDebug is a debugger that gives you a really good look at what's happening when you do a submit. <-- here's how to set it up. It's really, really useful.

Comment actions Permalink

I figured it out. I used <p> instead of inputss; oops.


Please sign in to leave a comment.