Jump to content

form is not inputing data to tables


shortybookit

Recommended Posts

i have a few registration pages so it is not to much on a page and the user says screw it

so the 1st page is basic email and password 2x they hit submit they are logged in

and i tell them they should update there account

 

they click update

they are asked a few questions and hit update it works

the 2nd page that comes up RESUMES is the one giving me a grey hair--

 

it is not submitting to tables

 

here is 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

?>

 

here is the form itself

<h1>Resume</h1>
<p>
<span class="required">*</span> Required information
</p>

<hr />
<form method="post" action="resume.php">
<fieldset>
<legend>Resume Information</legend>
<dl>
	<dt>
		<label for="resume_title">Resume Title</label> <span class="required">*</span>
	</dt>
	<dd>
		<input type="text" name="resume_title" value="{$User->resume->title}" id="resume_title" class="input" size="40" />
		{if isset( $resume_title_error ) }
		<div class="required">{$resume_title_error}</div>
		{/if}
		<span class="hint">Use something catchy so employers will be drawn to your resume.<span class="hint-pointer"> </span></span>
	</dd>

	<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 />

<fieldset>
<legend>Employment Information</legend>
<dl>
	<dt>
		<label for="relocate">I am willing to relocate</label> <span class="required">*</span>
	</dt>
	<dd>
		<input type="radio" name="relocate" value="1" id="relocate" class="input" {if $User->resume->relocate eq 1}checked{/if} /> Yes     
		<input type="radio" name="relocate" value="0" id="relocate" class="input" {if $User->resume->relocate eq 0}checked{/if} /> No
		{if isset( $relocate_error ) }
		<div class="required">{$relocate_error}</div>
		{/if}
	</dd>

	<dt>
		<label for="authorized">I am authorized to work in the U.S.</label> <span class="required">*</span>
	</dt>
	<dd>
		<input type="radio" name="authorized" value="1" id="authorized" class="input" {if $User->resume->authorized eq 1}checked{/if} /> Yes     
		<input type="radio" name="authorized" value="0" id="authorized" class="input" {if $User->resume->authorized eq 0}checked{/if} /> No
		{if isset( $authorized_error ) }
		<div class="required">{$authorized_error}</div>
		{/if}
	</dd>
</dl>
</fieldset>
<br />

<dl>
	<dt>
		<input type="hidden" name="update" value="1" />
	</dt>
	<dd>
		<input type="submit" name="update" value=" Update " class="button" />
	</dd>
</dl>
</form>

 

and my table

 

-- phpMyAdmin SQL Dump

-- version 2.6.3-pl1

-- http://www.phpmyadmin.net

--

-- Host: mysql

-- Generation Time: Mar 30, 2007 at 03:25 AM

-- Server version: 4.1.14

-- PHP Version: 4.3.11

--

-- Database: `eric`

--

 

-- --------------------------------------------------------

 

--

-- Table structure for table `resumes`

--

 

CREATE TABLE `resumes` (

  `user_id` int(11) NOT NULL default '0',

  `title` varchar(50) default NULL,

  `status` tinyint(1) default NULL,

  `contents` text,

  `relocate` tinyint(1) default NULL,

  `authorized` tinyint(1) default NULL,

  PRIMARY KEY  (`user_id`),

  KEY `user_id` (`user_id`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

--

-- Dumping data for table `resumes`

--

 

INSERT INTO `resumes` VALUES (1, 'fdsgdf', 0, '', 0, 1);

INSERT INTO `resumes` VALUES (2, '', 0, '', 0, 0);

 

 

i am getting the following error on my table

 

PRIMARY and INDEX keys should not both be set for column `user_id`

 

but i dont know what shoud b what with that so i tried about 30 different varations and nothing seems to get the inputed date from the form to the table

 

help--:(

 

Link to comment
https://forums.phpfreaks.com/topic/44873-form-is-not-inputing-data-to-tables/
Share on other sites

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.