Advertisement:

Author Topic: SOLVED -- i need a little help from codders  (Read 991 times)

phpd

  • Full Member
  • ***
  • Posts: 236
SOLVED -- i need a little help from codders
« on: February 08, 2013, 10:19:47 pm »
Hello guys

I`m working on a plugin and it`s almost finished but i`m stuck now at one silly thing :)
all works well when i call the plugin in some existent pages but if i want to create a new custom page it keeps redirecting me to index when i`m trying to submit one form.
So i have the code.....

Code: [Select]
<div class="form-month">
            <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<label for='months'><?php _e('Select your month''events_manager');?></label>
            <select name="months">
  <option value="Jan"><?php _e('January''events_manager'); ?></option>
  <option value="Feb"><?php _e('February''events_manager'); ?></option>
                    <option value="Mar"><?php _e('March''events_manager'); ?></option>
                    <option value="Apr"><?php _e('April''events_manager'); ?></option>
                    <option value="May"><?php _e('May''events_manager'); ?></option>
                    <option value="Jun"><?php _e('June''events_manager'); ?></option>
                    <option value="Jul"><?php _e('July''events_manager'); ?></option>
                    <option value="Aug"><?php _e('August''events_manager'); ?></option>
                    <option value="Sep"><?php _e('September''events_manager'); ?></option>
                    <option value="Oct"><?php _e('October''events_manager'); ?></option>
                    <option value="Nov"><?php _e('November''events_manager'); ?></option>
                    <option value="Dec"><?php _e('December''events_manager'); ?></option>
</select>
            <input type="submit" class="form-submit-button" name="submit_month" value="<?php _e('Submit''events_manager'); ?>" />
</form>
            </div>

and the php code that`s handling the form

Code: [Select]
if(isset($_POST['submit_month'])){

$sel_month = strtotime($_POST['months']);
$date = time();
$day = date('d',1);
$month = date('m',$sel_month);
$year = date('Y',$date);
$first_day = mktime(0,0,0,$month,1,$year);
$title = date('F', $first_day);
$day_of_the_week = date('D', $first_day);
}else{......bla bla bla

Am i missing something?

Calling the plugin on existing pages works ok but in a custom created page when u submit the form it keeps redirecting me to the
 index

The link to that page works ok with osc_get_static_page() and osc_get_page_url()......
« Last Edit: February 09, 2013, 12:10:13 am by phpd »

trains58554

  • Osclass contributor
  • Hero Member
  • *****
  • Posts: 3642
  • osCanyon, the class of Osclass
Re: i need a little help from codders
« Reply #1 on: February 08, 2013, 11:40:55 pm »
Adding the following code to your form should work if I am following what you are trying to do.

<input type="hidden" name="page" value="page" />
<
input type="hidden" name="id" value="page id" />


Also change the action to <?php echo osc_base_url(true); ?>

Jay

phpd

  • Full Member
  • ***
  • Posts: 236
Re: i need a little help from codders
« Reply #2 on: February 09, 2013, 12:04:03 am »
Did not help, i`m getting redirected to "page does not exist"

phpd

  • Full Member
  • ***
  • Posts: 236
Re: i need a little help from codders
« Reply #3 on: February 09, 2013, 12:09:37 am »
SOLVED

Works well with osc_static_page_url( )

Thx for help