how to update edit and delete data on same form

Recommended Answers

All 3 Replies

Use select:

<select name="action">
    <option>update</option>
    <option>delete</option>
</select>

Then:

if($_POST['action'] == 'update')
{
    # run update query
}

elseif($_POST['action'] == 'delete')
{
    # run delete query
}

else
{
    # return error: no allowed action was selected
}

If, instead, you want to update and delete within the same request then paste your script and give us more information.

<select>
      <option value="update">update</option>
      <option value="delete">delete</option>
</select>

<input type="text" name="other" value="keyword">

//this will make a variable of the select option update

$update = $_POST['update'];

//this will make a variable of the select option delete

$delete = $_POST['delete'];

//this will make a variable of the select option other
// in other words, defines whatever text is inserted in the input box as variable.

$other = $_POST['other']."=".$_POST['keyword']."*";

Hope this helps

Thank u so much for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.