Jump to content

help with form


ccrevcypsys

Recommended Posts

ok but it is really hard to understand.. and i know that..

	<div style='clear:left; margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Region:</div>
		<div style='margin-left: 100px'><input style='display:none;' type='text' name='region' size='50' value='0' /><em>All not yet working...</em><br><!--<input name='6' onClick='FormChangeALL()' type='checkbox' value='all'$sel />All<br>-->".$region_opt."</div>
	</div>

	<br />
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Document Type:</div>
		<div style='margin-left: 100px'>Do not choose Document Type untill preview page!<br><select ".$hidden." name='doc_type'>".$doc_opt."</select></div>
	</div>
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Document Date:</div>
		<div style='margin-left: 100px'><select ".$hidden." name='month'>".$month_opt."</select> / <select ".$hidden." name='date'>".$date_opt."</select> / <select ".$hidden." name='year'>".$year_opt."</select></div>
	</div>
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Title:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='title' size='50' value='".trim($row[title])."". $_POST['title']."' /></div>
	</div>

	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Abstract:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='abstract' size='50' maxlength='120' value='".trim($row['abstract'])."". $_POST['abstract']."' /></div>
	</div>

	<br />
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Source:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='source' size='50' value='".trim($row[source])."". $_POST['source']."' /></div>
	</div>
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>File:</div>
		<div style='margin-left: 100px'>".$file_field." <br />Be sure to upload this on the preveiw page.</div>
	</div>

	<br />
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>External URL:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='url' size='50' value='".trim($row[url])."". $_POST['url']."' /></div>
	</div>

	<br />
	<div style='clear: left; margin-bottom:5px;' >
		<div style='float: left; text-align: right; width: 90px'>Author:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='author' size='50' value='".trim($row[author])."". $_POST['author']."' /></div>
	</div>
	<div style='clear: left;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Page content<br />(HTML):</div>
		<div style='margin-left: 100px'><textarea ".$hidden." name='page_content' rows='10' cols='52' wrap='virtual'>".trim($row[page_content])."". $_POST['page_content']."</textarea></div>
	</div>
";
$hidden_field_list = "
	<div style='clear:left; display:none; margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Region:</div>
		<div style='margin-left: 100px'>".$region_opt."</div>
	</div>

	<br />
	<div style='clear: left; display:none;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Document Type:</div>
		<div style='margin-left: 100px'><select ".$hidden." name='doc_type'>".$doc_opt."</select></div>
	</div>
	<div style='clear: left; display:none;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Document Date:</div>
		<div style='margin-left: 100px'><select ".$hidden." name='month'>".$month_opt."</select> / <select ".$hidden." name='date'>".$date_opt."</select> / <select ".$hidden." name='year'>".$year_opt."</select></div>
	</div>
	<div style='clear: left; display:none;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Title:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='title' size='50' value='".trim($row[title])."". $_POST['title']."' /></div>
	</div>

	<div style='clear: left; display:none;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Abstract:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='abstract' size='50' maxlength='120' value='".trim($row['abstract'])."". $_POST['abstract']."' /></div>
	</div>

	<br />
	<div style='clear: left; display:none;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Source:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='source' size='50' value='".trim($row[source])."". $_POST['source']."' /></div>
	</div>
	<div style='clear: left; display:none;  margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>File:</div>
		<div style='margin-left: 100px'>".$file_field." <br />Be sure to upload this on the preveiw page.</div>
	</div>

	<br />
	<div style='clear: left;  display:none; margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>External URL:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='url' size='50' value='".trim($row[url])."". $_POST['url']."' /></div>
	</div>

	<br />
	<div style='clear: left;  display:none;margin-bottom:5px;' >
		<div style='float: left; text-align: right; width: 90px'>Author:</div>
		<div style='margin-left: 100px'><input ".$hidden." type='text' name='author' size='50' value='".trim($row[author])."". $_POST['author']."' /></div>
	</div>
	<div style='clear: left;  display:none; margin-bottom:5px;'>
		<div style='float: left; text-align: right; width: 90px'>Page content<br />(HTML):</div>
		<div style='margin-left: 100px'><textarea ".$hidden." name='page_content' rows='10' cols='52' wrap='virtual'>".trim($row[page_content])."". $_POST['page_content']."</textarea></div><input type='hidden' name='do' value='add' />
	</div>

now the php part

## Setup region select list
while ($row_region = @mysql_fetch_array($result_region, MYSQL_ASSOC)){
	$sel = "";

	if ($row[region] == $row_region[keyid]) {

		$sel = " checked";

	}elseif(isset($_POST[''.$row_region[keyid].''])){

		$sel = " checked";

	}

	$region_opt .= "<input name='$row_region[keyid]' type='checkbox' value='$row_region[keyid]'$sel />$row_region[region_name]";
}

while ($preview_query = @mysql_fetch_array($preview_query, MYSQL_ASSOC)){
	$docs .= "<option value='$preview_query[keyid]'$sel>$preview_query[title]</option>";
}


## Setup document types select list
while ($row_doc = @mysql_fetch_array($result_doc, MYSQL_ASSOC)){
	$sel = "";
	if ($row[doc_type] == $row_doc[keyid]) {
		$sel = " selected='selected'";
	}elseif($_POST['doc_type'] == $row_doc[keyid]){
		$sel = " selected='selected'";
	}
	$doc_opt .= "<option value='$row_doc[keyid]' $sel>$row_doc[doc_name]</option>";
}

  ## Create month select
## set defaults
$year = date("Y");
$month = date("m");
$date = date("d");

## Use stored date field if we're editing
if ($do == "update") {
	$date_values = explode("-", $row[date]);
	$year = $date_values[0];
	$month = $date_values[1];
	$date = $date_values[2];
}

## Setup month select
for ($i = 1; $i <= 12; $i++) {
	$sel = "";
	$num = date("m", mktime(0, 0, 0, $i, 1, 2000));
	if ($month == $num) {
		$sel = " selected='selected'";
	}
	$month_opt .= "<option value='".$num."'".$sel.">".$i."</option>";
}

## Setup date select
for ($i = 1; $i <= 31; $i++) {
	$sel = "";
	$num = date("d", mktime(0, 0, 0, 1, $i, 2000));
	if ($date == $num) {
		$sel = " selected='selected'";
	}
	$date_opt .= "<option value='".$num."'".$sel.">".$i."</option>";
}

## Setup year select
for ($i = 2002; $i <= $year+1; $i++) {
	$sel = "";
	$num = date("Y", mktime(0, 0, 0, 1, 1, $i));
	if ($year == $num) {
		$sel = " selected='selected'";
	}
	$year_opt .= "<option value='".$num."'".$sel.">".$i."</option>";
}

## If preview make divs hidden
if($_GET['do']=="prev"){
$hidden = "readonly";
$value = "Edit Form";
$action = $_SERVER['PHP_SELF']."?do=add";
$methodprev = "post";
}else{
$value = "CANCEL";
$action = $_SERVER['PHP_SELF'];
$methodprev = "";
}

Heres a picture example

stuff.gif

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.