Jump to content

[SOLVED] 1 Form 2 Locations


supanoob

Recommended Posts

yes you have to make 2 submit buttons with varying values

then do this

before the form

<?php
if ($_POST['submit'] == 'option1')
{exit(require('option1.php'));}
if ($_POST['submit'] == 'option2')
{exit(require('option2.php'));}
//etc etc add more for more options
?>

Link to comment
Share on other sites

sorry my heads all over atm...

 

this is the code that checks the 2 buttons

 

<?php

if ($_GET['step'] == 'save_delete')
{
//delete them
if ($_POST['submit'] == 'delete')
{
$ids_to_delete = $_POST['ids_to_delete'];

//Run the delete-query for each entry in the $ids_to_delete array
foreach($ids_to_delete as $id_to_delete) {

$sql2="UPDATE mail SET mail_deleted='1' WHERE mail_id='$id_to_delete'";
if(mysql_query($sql2));

$sql2="UPDATE accounts SET mail=mail-1 WHERE account_id='$account_id'";
if(mysql_query($sql2));

}
echo "Checked Items Deleted.";
}

//if wanting to save
if ($_POST['submit'] == 'save')
{
$ids_to_delete = $_POST['ids_to_delete'];

//Run the delete-query for each entry in the $ids_to_delete array
foreach($ids_to_delete as $id_to_delete) {

$sql2="UPDATE mail SET mail_saved='1' WHERE mail_id='$id_to_delete'";
if(mysql_query($sql2));

}
echo "Checked Mail Saved";
}

}

?>

 

and this is the code that has the buttons

 

<?php

<input type=\"submit\" value=\"Delete Checked\" name=\"delete\"> <input type=\"submit\" value=\"Save Checked\" name=\"save\"></form></center><br><br>";


?>

Link to comment
Share on other sites

<input type=\"submit\" value=\"Save Checked\" name=\"save\">

 

Just to shorten the time taken to get this working, if you want to test the value sent from that, you want to examine the value of the NAMEd input, i.e. what is $save in the instance above.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.