reference...

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

border20
New php-forum User
New php-forum User
Posts: 32
Joined: Tue Jan 28, 2003 10:19 am
Location: Québec
Contact:

reference...

Postby border20 » Tue Feb 11, 2003 7:53 am

I need to have a submit button wich reloads the form with values of variables in parameter,,, i thought of somethine like this

<p><a href="xcoord=<?$var1?> ycoord=<?$var2?>"><input type="submit" value="Submit" name="submit"></a></p>

but it doesn't work,,, can anyone help ??

Hurkle
New php-forum User
New php-forum User
Posts: 36
Joined: Tue Jan 07, 2003 8:45 am
Location: Minnesota, USA

Postby Hurkle » Tue Feb 11, 2003 8:15 am

Try something like this to get an idea of how this works..

Assume that your form is described in the code below, and 'frm_process.php' is the script that processes it.

Code: Select all


echo "<FORM name = 'frm_vars' method = 'post' ";

echo " action = 'frm_process.php?get_x=" . $var1;

echo "&get_y=" . $var2 . "'>";

echo "<INPUT type = 'hidden' name = 'post_x' value = '" ;

echo $var1 . "'>";

echo "<INPUT type = 'hidden' name = 'post_y' value = '" ;

echo $var2 . "'>";

echo "<INPUT type = 'submit' value = 'Submit'>";

echo "</FORM>";




and a little bit of the script frm_process.php..

Code: Select all


if (isset($_POST['post_x'){

  echo "value of x from post is: " . $_POST['post_x'];

  }

if (isset($_POST['post_y'){

  echo "value of y from post is: " . $_POST['post_y'];

  }

if (isset($_GET['get_x'){

  echo "value of x from post is: " . $_POST['post_x'];

  }

if (isset($_GET['get_y'){

  echo "value of y from post is: " . $_POST['post_y'];

  }







That should get you started. POST values come from form elements, such as inputs, hidden, selects, text areas, text boxes, etc. GET values can come from forms wich have there method set to 'get', (which I never do..) but usually contain the querystring values.

Best of luck, hope this helps.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests