Forms

taekwondokid42

New Member
Messages
268
Reaction score
0
Points
0
How to I create a forum that has a set value?

Example: <input="<?$variable?>" name="variable">
<input type="submit">
 

eddysweb

New Member
Messages
63
Reaction score
0
Points
0
hey,

it would look something like:
Code:
Example: <input="<?PHP $var; ?>" name="var">
<input type="submit">
notice the ; after the $var, you must have this in there
 

Slothie

New Member
Messages
1,429
Reaction score
0
Points
0
=/
PHP:
<input type="text" name="variable1" value="<?php echo $variable; ?>">
<input type="submit">

That's assuming its a text variable you want to output. Checkboxes/ radio boxes and text areas have it differently.
Edit:
hey,

it would look something like:
Code:
Example: <input="<?PHP $var; ?>" name="var">
<input type="submit">
notice the ; after the $var, you must have this in there

What do you expect PHP to do with the $var?
 
Last edited:

Thewinator

New Member
Messages
256
Reaction score
0
Points
0
Slothie is right, if you want it to be a set value you don't need php for that.
HTML:
<input type="text" name="variable" value="yourSetValue" />
Or if you want a textarea
HTML:
<textarea name="variable">yourSetValue</textarea>
And last is a radio/checkbox
HTML:
<input type="radio" name="variable" value="theRadioValue" checked />
 
Last edited:

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
How to I create a forum that has a set value?

Example: <input="<?$variable?>" name="variable">
<input type="submit">

1stly you would create a Forum using forum software.
2ndly to create a form you could do the following:

FORM.php
PHP:
<html>
<head>
</head>
<body>
<form method="post" action=ENGINE.php">
<select name="drop_down">
      <option value='' ="selected">Please Select A Option</option>
      <option value="opt_1">option 1</option>
</select>
<input type="text" size="50" maxlength="30" name="fullname" /> 
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>

ENGINE.php
PHP:
<html>
<head>
</head>
<body>
<?php
if (!isset($_POST['drop_down'];))
{
echo 'The required field is empty, click back and retry.'; ?>
<form>
<input type ="button" name ="back" value="Go Back" onclick="history.go(-1)">
</form>
<?php
} else
{
$drop_down = $_POST['drop_down'];
$fullname = $_POST['fullname'];
// do what ever you want with these varibles/scalars
}
?>
</body>
</html>
 
Last edited:
Top