adrianmak Posted February 22, 2015 Posted February 22, 2015 search <?php $page->body .= "Content Search<br/> <p> <form action='/pw1/query2.php' method='post'> <input type='text' id='search' autocomplete='off' name='search'> <input type='submit' value='submit'> </form> <p> <h4 id='results-text'>Showing results for: <b id='search-string'>Array</b></h4> <div id='results'></div> "; include("./main.php"); query2.php <?php // ProcessWire bootstrap include('index.php'); $temp_var = $wire->$input->post->search; //$temp_var = $_POST["search"]; echo($temp_var); When form submitted to query2.php, no form value echoed. if I use PHP built-in $_POST , submitted value is echoed.
adrianmak Posted February 22, 2015 Author Posted February 22, 2015 (edited) @Adrian, your code works. From reading the api doc https://processwire.com/api/include/ These two are equivalent, so what syntax you prefer to use is up to you: $mypage = $wire->pages->get("/about/contact/"); $mypage = wire('pages')->get("/about/contact/"); $temp_var = $wire->input->post->search; $temp_var = wire('input')->post->search; Aren't they equivalent ? --------------------------- Read again from my op, I putted a $ sign for the input, that's why it is not working Edited February 22, 2015 by adrianmak
adrian Posted February 22, 2015 Posted February 22, 2015 Yes, they are equivalent, but you had: $wire->$input->post->search; instead of: $wire->input->post->search; Note the $ before input in your version. Sorry I should have explained a little more completely 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now