Jump to content

need help with forms and variables


jbwebdesign

Recommended Posts

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...