Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    if(isset($_POST wont works in Joomla with jumi

    Hi to all!

    I have a working php page integrated in a Jumi module, this page contains a form with an hidden field:

    PHP Code:
    <form  method='post' action='index.php?option=com_content&view=article&id=10?start=$start' enctype='multipart/form-data'><input type='submit' name='prov' value='Publish' /><input type='hidden' name='id1' value='$id'/><input type='hidden' name='start1' value='$start'/><input type='hidden' name='prov' value='form'/></form
    so with this statement:

    PHP Code:
    if(isset($_POST['prov'])){
    $_POST['id1'] = $id1;
    $_POST['start1'] = $start1;
    $redirect_page "index.php?option=com_content&view=article&id=2&number=$id1"
    header('location: ' $redirect_page);

    It understand that the form is sent and it should go to another page, but the problem is that $_POST['id1'] and $_POST['start1'] don't get values, why? Out of joomla all works correvtly...
    Last edited by havana7; 02-12-2010 at 04:23 PM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    No clue how joomla works.
    You can't just add onto the _POST array, its always extracted on the first load. With this, you can simply retrieve from $_GET since you're passing the same information over. If you want to send post without a form, you'll need to look into something like curl to force post headers instead of get headers.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thnx but i would like to mantain this code if possible.
    I've tried with print_r($_POST); and i get:

    Array ( [prov2] => form [id1] => [start1] => [layout] => default [view] => article )

    no POST variables...

    EDIT:

    Solved in this way:

    PHP Code:
    if(isset($_POST['prov'])){ // si viene dal form, si processano i dati e si effettua il redirect
    // si processano tutti i dati del form 
    $_GET['id1'] = $id1;
    $_GET['start1'] = $start1;

    $query2 "UPDATE  table SET number= '1'  WHERE id = '".$_POST['id1']."' " 
    $result2 mysql_query($query2) or die ("ERROR!" mysql_error(). 'Query: '.$query2);
    $redirect_page "index.php?option=com_content&view=article&id=10?start=".$_POST['start1'].""
    header('location: ' $redirect_page); }; 
    Don't ask me why it works, i don't know, absolutly!!!
    Last edited by havana7; 02-12-2010 at 05:36 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •