Forum Moderators: coopster

Message Too Old, No Replies

executing a script then go to other page

form handling

         

web_server

8:24 am on Mar 24, 2006 (gmt 0)



Hi there,
I would like to ask to 2 question:
question1:
I have a simple form with 2 buttons , one of them is a submit button.

< form action="page1.php" method="post">
<input type="submit" >
</form>

I want to execute a script when the user clicks on the submit button then go to the page1.php .
I put
if (isset($submit)) after the form but it dosen't work.

question2:
again I have a a simple form with textarea field and a combobox . I bring the data in both (textarea field + combobox) from the database
I want that when the user chooses one of the combobox options the textarea field changes with it .
any ideas?
thank you .

scriptmasterdel

11:18 am on Mar 24, 2006 (gmt 0)

10+ Year Member



question 1:
<?php
if(isset($_REQUEST['submit']))
{
header("Location: location.php");
}
elseif(isset($_REQUEST['news']))
{
header("Location: news.php");
}
?>

<form>
<input type="submit" name="submit">
<br>
<input type="submit" name="news">
</form>

the field "name" is posted , not the type

question2: Your really need to look into javascript to do this ....

Hope i have helped, please let me know ....

Del

Blerfaap

12:27 pm on Mar 24, 2006 (gmt 0)

10+ Year Member



This is probably gonna give an header error (header already send)....

question 1:
<?php
if(isset($_REQUEST['submit']))
{
header("Location: location.php");
}
elseif(isset($_REQUEST['news']))
{
header("Location: news.php");
}
?>

scriptmasterdel

12:50 pm on Mar 24, 2006 (gmt 0)

10+ Year Member



How come, It hasn't sent any headers out before the request?

Please explain more ....

Blerfaap

2:46 pm on Mar 24, 2006 (gmt 0)

10+ Year Member



Sorry, it does work this why. My fault....

web_server

6:10 pm on Mar 24, 2006 (gmt 0)



Thank you so much scriptmasterdel
it works perfect.