Jump to content

isakhejnesen

New Members
  • Posts

    2
  • Joined

  • Last visited

isakhejnesen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi php Freaks XD I have a small problem. I have a form that i would like to make it so i can add a column to my table on my site. but the form that fills our the stuff, when i press the submit button i don't get a response. Here is a rly simple code that i can't get to work. When i press the button it should say "success", and if the textbox is empty it should say "error". simple right? Well i can't get any response what so ever. here is the code in simpel. if(isset($_POST['addTableBtn'])){ if(empty($_POST['addTableText'])){ echo "Error"; }else{ echo "Success"; } } and the submit button name and textbox name match, i have checket.
  2. Hi there. I have a small problem, i want to use strrpos and i dont want to make a textbox in the browser so i can write what ever word i want to search for and enter it. here is the code. $string = "Dette er en dummy tekst. Den kan bruges til mange forskellige ting.<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam pellentesque faucibus pretium. Duis vehicula lacus vitae lacus adipiscing dignissim. Suspendisse mauris nulla, vehicula id orci semper, iaculis tincidunt nisl. Quisque congue magna eu elit posuere lacinia eu eget neque. Vivamus est sapien, porta at lacinia eget, commodo vitae lectus. Donec non velit at justo viverra suscipit eu quis purus. Integer tempor lacinia turpis, et aliquet est dignissim non. Aenean euismod dignissim turpis id sollicitudin. Phasellus vitae iaculis orci. Phasellus luctus faucibus tortor vitae porta. Proin semper tristique erat. Suspendisse ac fringilla elit, iaculis condimentum leo. Aliquam sit amet massa non dui congue laoreet eget et libero. Integer viverra nisi a justo tempor sollicitudin. Etiam volutpat aliquet malesuada. Ut erat neque, adipiscing sed dictum ut, commodo vel lacus.</p>"; echo '<h1>Strpos test</h1>'; echo ' <form> <input type="text" placeholder="Search" name="textbox" /> <input type="submit" name="searchButton" value="search" /> </form> '; if(isset($_POST['searchButton'])){ $textbox = $_POST['textbox']; }else{ echo 'type word to search '; } echo '<br />Your result is number '; echo strrpos($string, "word"); But i get the error that i have a Undefined variable: textbox in line 29 How can i make it so that what ever i enter in the textbox form will be the word that is searches for heres a link if you don't know what strrpos is. http://www.w3schools.com/php/func_string_strrpos.asp
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.