We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5498
    • 9 Posts
    [Solved, thanks to ganeshXL]
    Hello all,

    I could use a little help figuring out why the below code will not do what is intended in MODx.

    <?php
    if(!isset ($_POST['submitCS']) ) {
    
    echo "<form name=\"exhibitor-search\" method=\"POST\" action=\"exhibitor-search.php\">
    
    	<fieldset>
    	
    		<legend>Search by Company name</legend>
    		<ul>
    			<li><label for=\"Company name\">Company name : </label><input type=\"text\" id=\"cName\" name=\"cName\" /><input type=\"submit\" value=\"Search by Company\" id=\"submitCS\" name=\"submitCS\" class=\"input\" /><input type=\"reset\" value=\"Reset\" name=\"reset\" id=\"reset\" class=\"input\" /></li>
    		</ul>
    	
    	</fieldset>
    
    </form>";
    }
    else {
    
    $cs = $_POST['cName'];
    echo $cs;
    
    }
    ?>


    This all started from needing to query a database, and after debugging I get down to the simplest, which will not work. When I submit the form, it simply echo’s the form back out. I have the above code in a snippet, then inserted the snippet into the page. I did test this brief code and the full code outside of MODx (text file on same local server test MODx on) and it works fine.

    I have 0.9.6 with wampserver

    Thanks in advance for any help.
      • 5498
      • 9 Posts
      Thank you for your response ganeshXL.

      I did not use the syntax and it does now work when I do!

      Thank you, thank you!