Jump to content

[SOLVED] Generate form fields


pcw

Recommended Posts

I was wondering if it was possible to generate form fields:

 

For example, the user would enter a form field name and then select

 

textfield

textarea

checkbox

radio button

etc.

 

Once they click modify, I need it to generate that form field, and write the field name to a MySQL database, and a column for the value when entered.

 

Is this at all possible? And how would I go about doing this?

 

Thanks

Link to comment
Share on other sites

you want to generate the form and have it displayed in html?

 

if so, you can put the html code for each form inside different php variables

and 'on modify', refresh the page, and echo the variable for the selected form

that'll get the form "pasted" into html

 

and then regularly fetch the field's name and make a normal insert to the db

 

 

the rest of the mysql column stuff just check the manual to create those on the fly

i have no idea what your going about, cause im a lame mysql developer

Link to comment
Share on other sites

You could do it easily using PHP.

 

If you send me an email, I can help you out: info@akatsukidesigns.com

 

A basic setup of the code would be like...


<form>
echo '
choose field type...
<select name="whatever">
<option>Radio</option>
<option>etc...</option>
</select>
<input type="submit">
</form>';

if ($_POST['submit'])
{

$whatever = $_POST['whatever'];

if ($whatever = 'radio')
{

// the radio field

}

}

 

Instead of "if" statements, you could always use case statments.

Link to comment
Share on other sites

I have been messing about with the code posted above and cant seem to get it right.

I would like the field type created, to be given the name of the value entered into field name.

EG. If a user entered 'first_name' into Field Name, and they selected 'Text Field' from the Field Type, then the Text Field created should be called 'first_name'.

Is this possible? And how could I get the form to keep reappearing so the user can add more fields? Any help is much aprreciated.

 

<?php
print "<form method=\"post\">
Field Name: <input type=\"text\" name=\"field_name1\">
Field Type: <select name=\"name\">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
</select>
<input type=\"submit\">
</form>";
if ($_POST['submit'])
{
$name = $_POST['name'];
if ($name = 'Text Field')
{
print "<input type=\"text\" name=\"$name\">";
}
if ($name = 'Text Area')
{
print "<textarea name=\"$name\">";
}
if ($name = 'Radio Button')
{
print "<input type=\"radio\" name=\"$name\" value=\"$value\">";
}
if ($name = 'Checkbox')
{
print "<input type=\"checkbox\" name=\"$name\" value=\"$value\">";
}
}
?>

Link to comment
Share on other sites

this should do what you want:

<?php


if ($_POST['submit'])
{

$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
echo '<input type="text" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="text" name="'.$name.'" /></textarea>';
}
if ($type == 'Text Area')
{
echo '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><textarea cols="5" rows="4" name="'.$name.'"></textarea></textarea>';
}
if ($type == 'Radio Button')
{
echo '<input type="radio" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="radio" name="'.$name.'" /></textarea>';
}
if ($type == 'Checkbox')
{
echo '<input type="checkbox" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="checkbox" name="'.$name.'" /></textarea>';
}

echo '<p><a href="form.php">Try again</a></p>';

} else {



echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
</select>
<input type="submit" name="submit" value="submit">
</form>';

}
?>

 

Link to comment
Share on other sites

Hi, thanks for your reply. I have been working on a variation of what you posted, but cant seem to get it right. This is what i got so far:

 

<?php

echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select>
<input type="submit" name="submit" value="submit">
</form>';

if ($_POST['submit'])
{

$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
echo '<input type="text" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="text" name="'.$name.'" /></textarea>';
}
if ($type == 'Text Area')
{
echo '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><textarea cols="5" rows="4" name="'.$name.'"></textarea></textarea>';
}
if ($type == 'Radio Button')
{
echo '<input type="radio" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="radio" name="'.$name.'" /></textarea>';
}
if ($type == 'Checkbox')
{
echo '<input type="checkbox" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="checkbox" name="'.$name.'" /></textarea>';
}
if ($type == 'Select')
{
echo '<select name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><select name="'.$name.'" /></textarea>';
}

}
?>

 

I have moved the form to the top as it always needs to be visible.

 

Instead of refreshing the page on every submission, I would like the new code to be added to the text area.

 

Also for generating the select menu, how do I create a field where users can enter the options, and then once submitting the form, the code in the text area generates the select code and option tags?

 

Thanks

Link to comment
Share on other sites

I am currenty working on date issues so here is some script that spits out th date...

 


<?
if (isset($_POST['date'])){
$month=$_POST['month'];
$day=$_POST['day'];
$year=$_POST['year'];

echo "$month / $day / $year";

}

$thisYear=date('Y');
$thisYearPlus=date('Y', strtotime('+1 year')); // ADD WHAT YOU WANT

echo"<form action='' method='post'>";

echo"<select name=month>";getoption(1, 12, date("m"));echo "</select>";

echo"<select name=day>";getoption(1, 31, date("d"));echo "</select>";

echo"<select name=year>";getoption($thisYear, $thisYearPlus, date('Y'));echo "</select>";

echo"<input type='submit' name='date' value='GO'>";

echo"</form>";

function getoption($start, $end, $if) {
for ($i=$start;$i<=$end;$i++) {
	echo "<option value=$i"; if ($i == $if) { echo " selected";} echo ">$i";
}
}
?>

 

$helpful="Maybe";

Link to comment
Share on other sites

Hi

 

Give this a try. Think this is what you want.

 

<?php

echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select>
<input type="submit" name="submit" value="submit">';

if ($_POST['submit'])
{


$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
$NewField = '<input type="text" name="'.$name.'" />';
}
if ($type == 'Text Area')
{
$NewField = '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
}
if ($type == 'Radio Button')
{
$NewField = '<input type="radio" name="'.$name.'" />';
}
if ($type == 'Checkbox')
{
$NewField = '<input type="checkbox" name="'.$name.'" />';
}
if ($type == 'Select')
{
$NewField = '<select name="'.$name.'" />';
}
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].chr(13).$NewField.'</textarea>';

}
echo '</form>';

?>

 

All the best

 

Keith

Link to comment
Share on other sites

Hi, thanks for your reply kickstart.

 

That is what I need to do, but when I run this script and add the fields, this is what I get :

 

<input type=\\\"text\\\" name=\\\"first name\\\" />
<input type=\"text\" name=\"surname\" />
<textarea cols="5" rows="4" name="address">

 

It adds another \ for every entry made. How do I fix this?

 

Also, is it possible to create a field so if a user creates a 'Select' field, then they can enter the 'options' for that field, that are then printed in the preview area?

 

Thanks

Link to comment
Share on other sites

For that many If statements you may wish to use case statements. It would clean up your code a small bit. Upto you but it saves you calling the variables each time.

 

Look at my example with ifs

 


<?
$name = $_GET["name"];

if('john' == $name) {
DO ACTION
}

elseif('saraj' == $name) {
DO ACTION
}

 

Wheras with case

 


<? 

$name = $_GET["name"];

switch($name) {

case john:
DO STUFF HERE
break;

case sarah:
DO STUFF HERE
break;

default:
DO STUFF HERE FOR DEFAULT WITHOUT ANY OF ABOVE
break;

}

?>

 

As you can see it has already made things look a little cleaner. Upto you in the end...

 

 

With regards to your repeating hashes I will try and replicate the error myself.

Link to comment
Share on other sites

That is what I need to do, but when I run this script and add the fields, this is what I get :

 

Hmmm, interesting. That doesn't happen for me. Have you done any manipulated of the fields on return (eg, using htmlspecialchars)?

 

Also, is it possible to create a field so if a user creates a 'Select' field, then they can enter the 'options' for that field, that are then printed in the preview area?

 

Would be possible and not really that difficult, but would take a bit of fiddling. Not sure why you want this page but I would be tempted to do it a bit more crudely and just add the option for a select drop down as an extra field (so if you are just using this to generate input fields easily then it would just require manually shuffling the </SELECT> after the options).

 

I would agree with above comment about using a switch statement instead of multiple if statements.

 

All the best

 

Keith

Link to comment
Share on other sites

Hi, thanks for your reply again :)

 

The code I am using is this

 

<?php

echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select>
<input type="submit" name="submit" value="submit">';

if ($_POST['submit'])
{


$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
$NewField = '<input type="text" name="'.$name.'" />';
}
if ($type == 'Text Area')
{
$NewField = '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
}
if ($type == 'Radio Button')
{
$NewField = '<input type="radio" name="'.$name.'" />';
}
if ($type == 'Checkbox')
{
$NewField = '<input type="checkbox" name="'.$name.'" />';
}
if ($type == 'Select')
{
$NewField = '<select name="'.$name.'" />';
}
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].chr(13).$NewField.'</textarea>';

}
echo '</form>';

?>

 

But when I run the script and add fields, this is what I get

 

<input type=\\\"text\\\" name=\\\"first name\\\" />
<input type=\"text\" name=\"surname\" />
<textarea cols="5" rows="4" name="address">

 

I dont think I have changed anything from what you posted, but cant work out what is wrong.

Link to comment
Share on other sites

Is that the only code you're using? You're not trying to write a file with that by chance, are you? That's the only thing I can think of that would give you that kind of error.

 

My code should have worked perfectly. I tested it and everything.

Hi, thanks for your reply. I have been working on a variation of what you posted, but cant seem to get it right. This is what i got so far:

 

<?php

echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select>
<input type="submit" name="submit" value="submit">
</form>';

if ($_POST['submit'])
{

$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
echo '<input type="text" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="text" name="'.$name.'" /></textarea>';
}
if ($type == 'Text Area')
{
echo '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><textarea cols="5" rows="4" name="'.$name.'"></textarea></textarea>';
}
if ($type == 'Radio Button')
{
echo '<input type="radio" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="radio" name="'.$name.'" /></textarea>';
}
if ($type == 'Checkbox')
{
echo '<input type="checkbox" name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><input type="checkbox" name="'.$name.'" /></textarea>';
}
if ($type == 'Select')
{
echo '<select name="'.$name.'" />';
echo '<p>view code:</p>';
echo '<textarea cols="60" rows="5"><select name="'.$name.'" /></textarea>';
}

}
?>

 

I have moved the form to the top as it always needs to be visible.

 

Instead of refreshing the page on every submission, I would like the new code to be added to the text area.

 

Also for generating the select menu, how do I create a field where users can enter the options, and then once submitting the form, the code in the text area generates the select code and option tags?

 

Thanks

 

this code should have worked the way you want it. the only other option to make it more smooth i can think of is using javascript. if you use that, you probably won't get those \"\ errors anymore. (I don't really know javascript though, so I can't help with that).

Link to comment
Share on other sites

Hi, this is the code I need to use. I am just having trouble with the select part :

 

<?php

echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select>
<textarea cols="60" rows="5" name="field_options"></textarea>
<input type="submit" name="submit" value="submit">';

if ($_POST['submit'])
{

$option = $_POST['field_options'];
$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
$NewField = '<input type="text" name="'.$name.'" />';
}
if ($type == 'Text Area')
{
$NewField = '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
}
if ($type == 'Radio Button')
{
$NewField = '<input type="radio" name="'.$name.'" />';
}
if ($type == 'Checkbox')
{
$NewField = '<input type="checkbox" name="'.$name.'" />';
}
if ($type == 'Select')
{
$NewField = '<select name="'.$name.'" /><option>'.$option.'</option></select>';
}
echo '<p>view code:</p>';
echo stripslashes('<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].chr(13).$NewField.'</textarea>');

}
echo '</form>';

?>

 

When I try to generate a select menu, this is what is displayed:

 

<select name="county" /><option>Bedfordshire
Essex
Hertfordshire</option></select>

 

This is the only prob I am having with this script now. How would I generate the <option> and </option> tags for each value entered into the 'field_options' field?

Link to comment
Share on other sites

Hi

 

Doing that is going to make it far more complex.

 

Each option refers to a particular select drop down. Hence if you add another option you need to find the appropriate place in the textarea to put it (ie, between the <select> and the </select>), but taking account of there possibly being more than one select.

 

I would be tempted to have a drop down to generate the <select>, another to generate an <option></option> and another to generate the closing </select>. Then you would just add as many options as you wanted before closing the list.

 

However this would not work if you wanted to actually use the input fields on a screen as you generated them. Not sure if this would be an issue for your future use of thise script.

 

Anyway, example

 

<?php

echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select Start</option>
<option>Select Option</option>
<option>Select End</option>
</select>
<textarea cols="60" rows="5" name="field_options"></textarea>
<input type="submit" name="submit" value="submit">';

if ($_POST['submit'])
{

$option = $_POST['field_options'];
$type = $_POST['fieldtype'];
$name = $_POST['fieldname'];

if ($type == 'Text Field')
{
$NewField = '<input type="text" name="'.$name.'" />';
}
if ($type == 'Text Area')
{
$NewField = '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
}
if ($type == 'Radio Button')
{
$NewField = '<input type="radio" name="'.$name.'" />';
}
if ($type == 'Checkbox')
{
$NewField = '<input type="checkbox" name="'.$name.'" />';
}
if ($type == 'Select Start')
{
$NewField = '<select name="'.$name.'" />';
}
if ($type == 'Select Option')
{
$NewField = '<option>'.$name.'</option>';
}
if ($type == 'Select End')
{
$NewField = '</select>';
}
echo '<p>view code:</p>';
echo stripslashes('<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].chr(13).$NewField.'</textarea>');

}
echo '</form>';

?>

 

All the best

 

Keith

Link to comment
Share on other sites

Hi, thanks for your reply again. But this would not work, I need it to show the fields as they are generated.

 

What I really need is

 

foreach value entered into the text area, then wrap it in <option> tags.

 

 

Link to comment
Share on other sites

Hi

 

Mmmm. The way I would go about this would be the have a text field to enter an option. And have a button to generate another text field for another option (which you could keep clicking to add more options). The option field name could then just end in a number, and you increment the number each time for each new option. The button could either return the form to php and you could code it there, or you could use javascript to add more form fields (issue here is that when you add the new form fields it is likely to wipe out the contents of existing ones, so you need to store the contents, add the new field then restore the contents). Once you had finished adding options you would use your existing submit button to process the form in a similar way to how you do now (but with a foreach to loop through all the form fields and to pick up the ones for the options).

 

While certainly not that difficult it isn't trivial. I will have a play in a bit, but I really should do some real work at the moment!

 

All the best

 

Keith

Link to comment
Share on other sites

Hi

 

Learning languages takes a while. All you can do is keep trying.

 

I have knocked this up which I think does the kind of things you need. It does need a load of cleaning up to make it nicer to modify in the future, look nicer on screen and also make it a bit more obvious how you are to use it.

 

<?php

$optionCnt = 0;

if ($_POST['addoption'])
{
echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname" value="'.$_POST['fieldname'].'">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option selected="selected">Select</option>
</select><br />';
foreach($_POST as $field => $value)
{
	if (substr($field,0,11) == "optionvalue")
	{
		$optionCnt++;
		echo "<input type='text' name='$field' value='$value' /><br />";
	}
}
echo "<input type='text' name='optionvalue$optionCnt' value='' /><br />";		
echo '<textarea cols="60" rows="5" name="anoption0"></textarea>
<input type="submit" name="submit" value="submit">
<input type="submit" name="addoption" value="addoption">';
}
else
{
echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select><br />';
echo "<input type='text' name='optionvalue$optionCnt' value='' />";		
if ($_POST['submit'])
{

	$option = $_POST['field_options'];
	$type = $_POST['fieldtype'];
	$name = $_POST['fieldname'];

	if ($type == 'Text Field')
	{
	$NewField = '<input type="text" name="'.$name.'" />';
	}
	if ($type == 'Text Area')
	{
	$NewField = '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
	}
	if ($type == 'Radio Button')
	{
	$NewField = '<input type="radio" name="'.$name.'" />';
	}
	if ($type == 'Checkbox')
	{
	$NewField = '<input type="checkbox" name="'.$name.'" />';
	}
	if ($type == 'Select')
	{
		$NewField = '<select name="'.$name.'" />'.chr(13);
		foreach($_POST as $field => $value)
		{
			if (substr($field,0,11) == "optionvalue")
			{
				$NewField .= '<option>'.$value.'</option>'.chr(13);
			}
		}
		$NewField .= '</select>';
	}
	echo '<p>view code:</p>';
	echo stripslashes('<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].chr(13).$NewField.'</textarea>');
	echo '<input type="submit" name="submit" value="submit">
	<input type="submit" name="addoption" value="addoption">';
}
else
{	
	echo '<textarea cols="60" rows="5" name="anoption0"></textarea>
	<input type="submit" name="submit" value="submit">
	<input type="submit" name="addoption" value="addoption">';
}
}

echo '</form>';

?>

 

All the best

 

Keith

Link to comment
Share on other sites

Hi Keith, thanks for your reply. It was the closest script so far as to what I need to do.

 

I made a couple of adjustments, but if you submit the form with something such as a text field and then click addoption, it refreshes the page and the

previewarea appears blank again and the code for the text field is gone.

 

How do I just add the textfield without the previewarea refreshing?

Link to comment
Share on other sites

Hi

 

Err, oops.

 

The "addoption" is only for adding the options on a select drop dowm. It doesn't really do much processing, just puts the form out again with an extra input field for another option.

 

However I have seen what I have done. When "addoption" is processed it puts out the textarea again, but doesn't populate it with the data that was there (and also uses the wring field name...)

 

<?php

$optionCnt = 0;

if ($_POST['addoption'])
{
echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname" value="'.$_POST['fieldname'].'">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option selected="selected">Select</option>
</select><br />';
foreach($_POST as $field => $value)
{
	if (substr($field,0,11) == "optionvalue")
	{
		$optionCnt++;
		echo "<input type='text' name='$field' value='$value' /><br />";
	}
}
echo "<input type='text' name='optionvalue$optionCnt' value='' /><br />";		
echo stripslashes('<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].'</textarea>');
echo '<input type="submit" name="submit" value="submit">
<input type="submit" name="addoption" value="addoption">';
}
else
{
echo '<form name="makeformfield" method="post">
Field Name: <input type="text" name="fieldname">
Field Type: <select name="fieldtype">
<option>Text Field</option>
<option>Text Area</option>
<option>Radio Button</option>
<option>Checkbox</option>
<option>Select</option>
</select><br />';
echo "<input type='text' name='optionvalue$optionCnt' value='' />";		
if ($_POST['submit'])
{

	$option = $_POST['field_options'];
	$type = $_POST['fieldtype'];
	$name = $_POST['fieldname'];

	if ($type == 'Text Field')
	{
	$NewField = '<input type="text" name="'.$name.'" />';
	}
	if ($type == 'Text Area')
	{
	$NewField = '<textarea cols="5" rows="4" name="'.$name.'"></textarea>';
	}
	if ($type == 'Radio Button')
	{
	$NewField = '<input type="radio" name="'.$name.'" />';
	}
	if ($type == 'Checkbox')
	{
	$NewField = '<input type="checkbox" name="'.$name.'" />';
	}
	if ($type == 'Select')
	{
		$NewField = '<select name="'.$name.'" />'.chr(13);
		foreach($_POST as $field => $value)
		{
			if (substr($field,0,11) == "optionvalue")
			{
				$NewField .= '<option>'.$value.'</option>'.chr(13);
			}
		}
		$NewField .= '</select>';
	}
	echo '<p>view code:</p>';
	echo stripslashes('<textarea cols="60" rows="5" name="previewarea" >'.$_POST['previewarea'].chr(13).$NewField.'</textarea>');
	echo '<input type="submit" name="submit" value="submit">
	<input type="submit" name="addoption" value="addoption">';
}
else
{	
	echo stripslashes('<textarea cols="60" rows="5" name="previewarea" ></textarea>');
	echo '<input type="submit" name="submit" value="submit">
	<input type="submit" name="addoption" value="addoption">';
}
}

echo '</form>';

?>

 

The other issue is that it adds a blank option at the end of each select. Not sure whether you want that or not (be easy enough to bypass it).

 

All the best

 

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.