Jump to content

new 2 php-- basic question about forms and php


noobie

Recommended Posts

ok i am reposting this question with just what you need i did not get a response last time around

 

but i have a page that allows users to copy and paste there resume 3 of the 5 fields are posting to the database

 

here are the two fields that are not working

 

<dt>
		<label for="resume_status">Resume Status</label> <span class="required">*</span>
	</dt>
	<dd>
		<input type="radio" name="resume_status" value="{$User->resume->status}" id="resume_status" class="input" {if $User->resume->status eq 0}checked{/if} /> Private
		<input type="radio" name="resume_status" value="{$User->resume->status}" id="resume_status" class="input" {if $User->resume->status eq 1}checked{/if} /> Public
		{if isset( $resume_status_error ) }
		<div class="required">{$resume_status_error}</div>
		{/if}
		<span class="hint">You can decide whether your profile can be searched for (public) or not (private).<span class="hint-pointer"> </span></span>
	</dd>

	<dt>
		<label for="resume_contents">Resume Contents</label>
	</dt>
	<dd style="width: 100%;">
		<textarea name="resume_contents" id="resume_contents" rows="40">{$User->resume->contents}</textarea>
		{if isset( $resume_contents_error ) }
		<div class="required">{$resume_contents_error}</div>
		{/if}
		<span class="hint">Copy and paste your resume.<span class="hint-pointer"> </span></span>
	</dd>
</dl>
</fieldset>
<br />

 

and the php

<?php

class resume{

	var $title;
	var $status;
	var $contents;
	var $relocate;
	var $authorized;

	function resume( $id = null ){
		$this->get_resume( $id );
	} # resume()_eof

	function get_resume( $id = null ){
		if( empty( $id ) ){
			$this->title 		= '';
			$this->status 		= '';
			$this->contents 	= '';
			$this->relocate 	= '';
			$this->authorized 	= '';
		}
		else{
			$query = "SELECT * ".
					 "FROM ".RESUMES." ".
					 "WHERE user_id = '".input_num($id)."' "; 
			$result = mysql_query( $query );
			if( mysql_num_rows( $result ) > 0 ){
				$row = mysql_fetch_array( $result );
				$this->title 		= output_txt($row['title']);
				$this->status 		= $row['status'];
				$this->contents 	= output_txt($row['contents']);
				$this->relocate 	= $row['relocate'];
				$this->authorized 	= $row['authorized'];
			}
			else{
				$this->get_resume();
			}
		}
		return $this;			
	} # get_resume()_eof

} # class resume EOF

?>

 

i am also getting an error on the table i have user_id marked as primary and index is this screwing it up or is there something wrong with the stuff above?

 

thanks

I am no expert by any means and have loads to learn, but what is this??

 

{if isset( $resume_status_error ) }
		<div class="required">{$resume_status_error}</div>
		{/if}

 

I don't see an echo anywhere, nor do I see the <?php ?> tags. I have never seen an if statement started or ended like that {/if}?????    i would think that this needs to be

<?php

     if(isset($resume_status_error)){
         echo ' <div class="required">'.$resume_status_error.'</div>';
     }
?>

 

Secondly, where is the $_POST or $_GET methods to retrieve the form data? If auto register variables is set to on, then its a huge security risk. If it is not set to on, then you have to get or post the data before it is usable.

 

Start here, and then we can work on this further.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.