Jump to content

Recommended Posts

Posted

hello everyone, I was wondering if anyone can help me out.....I want to be able to set a variable as a value of one of my forms.....here is my code but it doesn't work

 

Untitled Document

send to:

 

<?php

$test = $_POST['test'];

if(isset($test)){

$monster = "testing";

}

 

?>

 

 

i want the value for $monster to be inside my text box by the name of "send_to"

 

if you have any ideas on how i can do this, please help me out. thanks:D

Posted

I'm not totally sure what you are attempting to do, since what you say you want to do and what your code do are very different things...

 

Are you looking for something like this?

 

>




Untitled Document



       $monster = "testing";
   ?>

</pre>
<form action="" name="test" method="POST">
       send to:

</form>
<br><br

 

If so, your main issue is that you need to set the variable before the form is rendered. As my example shows, you'll just need to move the PHP code where you set your variable above your form.

 

Also, remember your form needs a method (either POST or GET)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...