php - get action to happen, only when submit button is pressed -


i have code post users wall, however, @ minute post when page loaded, need post when 'post wall button submitted.

here code:

<div align="center"> <form method="get" action="translate.php"> <textarea name="status2" cols="50" rows="5"<input type="text"/> <?php echo str_ireplace(array     ('old','awkward','all','again','behind','along','alright','hello','among','children','yes','child','kids','food','barnard castle','beer','book','blow','beautiful','bird','burst','brown','burn','boots'),  array ('auld', 'aakwad', 'aall','agyen','ahint','alang','alreet','alreet','amang','bairns','aye','bairn','bairns','bait','barney','beor','beuk','blaa','bonny','bord','borst','broon','bourn','byeuts'),$status); ?>   </textarea><br>  <input type="submit" value="post wall" // did try wall code here still posted on page load  /> </form>  </div>  <?php  $args = array(     'message'   => 'hello world',     'link'      => 'http://apps.facebook.com/geordie-status/',     'caption'   => 'translate english geordie'     ); $post_id = $facebook->api("/$uid/feed", "post", $args);  ?> 

add name attribute input tag. , use isset check if user pressed submit button.

        <input type="submit" value="post wall" name="submit"         // did try wall code here still posted on page load          />         </form>  </div>      <?php             if (isset($_post['submit'])){         $args = array(             'message'   => 'hello world',             'link'      => 'http://apps.facebook.com/geordie-status/',             'caption'   => 'translate english geordie'             );         $post_id = $facebook->api("/$uid/feed", "post", $args);         }         ?> 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -