Welcome Guest, Not a member yet? Register   Sign In
Single html Form With Multiple Submit Buttons
#10

[eluser]Bill Hernandez[/eluser]
Code:
<!-- block [8400], or [8600] both work correctly, [8500] does not. -->

<form method='post' action="">
    <input type="submit" name="action" value="create" />
    <input type="submit" name="action" value="preview" />
</form>

<?php
// +---------+---------+---------+---------+---------+---------+
// [8400] this block works correctly
// +---------+---------+---------+---------+---------+---------+
$action = $this->input->post("action");
switch($action)
{
    case 'create':
        // $this->create();
        echo '<br>[8401] create';
        break;
    case 'preview':
        // $this->preview();
        echo '<br>[8402] preview';
        break;
}

// +---------+---------+---------+---------+---------+---------+
// [8500] these two lines do nothing
// +---------+---------+---------+---------+---------+---------+
echo '<br>[8501] do nothing ' . $this->input->post('preview');
echo '<br>[8502] do nothing ' . $this->input->post('create');

// +---------+---------+---------+---------+---------+---------+
// [8600] these two blocks work correctly
// +---------+---------+---------+---------+---------+---------+
if ($this->input->post('action') == 'create')
{
    // $this->create();
    echo '<br>[8601] create';
}

if ($this->input->post('action') == 'preview')
{
    // $this->preview();
    echo '<br>[8602] preview';
}

?&gt;


Messages In This Thread
Single html Form With Multiple Submit Buttons - by El Forum - 12-10-2010, 03:34 PM
Single html Form With Multiple Submit Buttons - by El Forum - 12-10-2010, 04:30 PM
Single html Form With Multiple Submit Buttons - by El Forum - 12-11-2010, 03:36 AM
Single html Form With Multiple Submit Buttons - by El Forum - 12-11-2010, 04:07 AM
Single html Form With Multiple Submit Buttons - by El Forum - 12-11-2010, 06:55 AM
Single html Form With Multiple Submit Buttons - by El Forum - 12-11-2010, 08:40 AM
Single html Form With Multiple Submit Buttons - by El Forum - 12-12-2010, 12:45 AM
Single html Form With Multiple Submit Buttons - by El Forum - 12-12-2010, 12:45 AM
Single html Form With Multiple Submit Buttons - by El Forum - 08-04-2012, 09:08 PM
Single html Form With Multiple Submit Buttons - by El Forum - 08-08-2014, 06:39 PM
Single html Form With Multiple Submit Buttons - by El Forum - 08-08-2014, 09:02 PM
Single html Form With Multiple Submit Buttons - by El Forum - 08-09-2014, 12:18 PM
Single html Form With Multiple Submit Buttons - by El Forum - 08-09-2014, 01:19 PM
Single html Form With Multiple Submit Buttons - by El Forum - 08-09-2014, 07:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB