how to pass php variable value to action attribute of html form

Hi all,

When i click the update button first time , the page can’t load the update.php page, it just load the same page, but when i click the same button second time, it can load , may i know why it doesn’t take any effect first? Please see below codes, thanks.

[php]<?php
$url=’’;
if(isset($_POST[‘update’]))
{$url=‘update.php’;}
?>

[/php]

Brgds/Brandon Chau

Because, $url is not set until you submit the form. Take $url out of the isset.

I’m only guessing in what you are trying to do, but would doing something like the following be easier?
[php]

update.php save.php changecarrier.php
[/php]

Hi Strider64,

Yes , you are right , your suggestion is more easier ;D
but i wanted to know why my codes didn’t work ^^" Can u advise how can work if i use ? Thank you.

Brgds/Brandon Chau

You can’t use if(isset($_POST[‘update’])) before the form is submitted. $_POST[‘update’] is not set that’s why it wont work…

[code] <?php

$url=‘update.php’;
?>

[/code]

Ok , thanks all

Brgds/Brandon Chau

Sponsor our Newsletter | Privacy Policy | Terms of Service