What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » php coding help

2 votes - 5 average   php coding help
Author: Message:
k776
Junior Member
**

Avatar

Posts: 98
Reputation: 3
– / Male / –
Joined: Aug 2004
RE: php coding help
I took what you said, edited it a tiny bit.

Im using my own form, set with
code:
method="post" action="<? echo $PHP_SELF; ?>"
with
code:
<?
require ("scripts/add.php");
?>
at the top of the page. Then in scripts/add.php, I have this:
code:
<?
require_once ("scripts/config.php");

$errors = array();
if ($_SERVER['REQUEST_METHOD']=="POST"){
$errors = process_form($errors);
}
function process_form($errors) {

$catid = $_REQUEST['catid'] ;
$mplink = $_REQUEST['mplink'] ;
$name = $_REQUEST['name'] ;
$dllink = $_REQUEST['dllink'] ;
$desc = $_REQUEST['desc'] ;
$pic = $_REQUEST['pic'] ;
   
if (empty($catid)) {
    $errors["No catid"]="Empty catid";
    }
if (empty($mplink)) {
    $errors["No mplink"]="Empty mplink";
    }
if (empty($name)) {
    $errors["No name"]="Empty name";
    }
if (empty($dllink)) {
    $errors["No dllink"]="Empty dllink";
    }
if (empty($desc)) {
    $errors["No desc"]="Empty desc";
    }
if (empty($pic)) {
    $errors["No pic"]="Empty pic";
    }
if (count($errors) == 0) {

mysql_query("INSERT INTO download_items (catid,mplink,name,dllink,desc,rate,type,pic) VALUES ('$catid','$mplink','$name','$dllink','$desc','$rate','$type,'$pic')");
header( "Location: scripts/add2.htm" );

}
return $errors;
}
function print_error($error) {
  echo "<b><font color=red>Error:</b> $error</font><br /><br />";
}
?>

but it doens't work. No errors, it does exactly what I want it to (check for missing fields, if none process, if some show error on the form). It just doesn't insert into the database, I have no idea why. Any ideas?? (rate and type dont need to be checked for missing feilds cause they are set to "Not Available by default".

(config hold the username, password and database name.) The code in it is:
code:
<?
$username ="******";
$password ="******";
$database="******";
$connection = mysql_connect("localhost","$username","$password");
@mysql_select_db("$database", $connection) or die( "<br><center><h2>Unable to select database, please refresh.</h2>If problem persists, please contact me using the form and report the error you are receiving if any.</center>");
?>

As for the slashes, how can I tell if I have magic quotes enabled??

So, if you find what is wrong, can you submit 2 versions, one with and one without slahes command thing, just in case.

As for what its for, adding downloads to my site.
catid = I have 8 different catagorys so catid is somewhere between 1-8
mplink = Main page link
name = Name of the download
dllink = Download link
desc = Description of the download
rate = My rating for the download
type = The type of download it is, Freeware, Shareware etc.
pic = A picture of the download

k776

This post was edited on 09-09-2004 at 12:14 AM by k776.
[Image: k776.jpg]
09-09-2004 12:10 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
php coding help - by Eljay on 09-04-2004 at 05:26 PM
RE: how to include smilies - by fluffy_lobster on 09-04-2004 at 05:59 PM
RE: php coding help - by Eljay on 09-04-2004 at 06:21 PM
RE: php coding help - by -dt- on 09-05-2004 at 05:45 AM
RE: php coding help - by k776 on 09-05-2004 at 06:09 AM
RE: php coding help - by Jammie on 09-05-2004 at 08:15 AM
RE: php coding help - by fluffy_lobster on 09-05-2004 at 04:35 PM
RE: php coding help - by k776 on 09-06-2004 at 09:18 AM
RE: php coding help - by WDZ on 09-06-2004 at 09:33 AM
RE: php coding help - by k776 on 09-08-2004 at 05:30 AM
RE: php coding help - by WDZ on 09-08-2004 at 12:51 PM
RE: php coding help - by k776 on 09-09-2004 at 12:10 AM
RE: php coding help - by WDZ on 09-09-2004 at 02:56 AM
RE: php coding help - by k776 on 09-09-2004 at 03:48 AM
RE: php coding help - by WDZ on 09-09-2004 at 04:23 AM
RE: php coding help - by k776 on 09-09-2004 at 04:51 AM
RE: php coding help - by WDZ on 09-09-2004 at 05:20 AM
RE: php coding help - by k776 on 09-09-2004 at 05:42 AM
RE: php coding help - by WDZ on 09-09-2004 at 12:38 PM
RE: php coding help - by k776 on 09-09-2004 at 08:46 PM
RE: php coding help - by fluffy_lobster on 09-10-2004 at 06:19 PM
RE: php coding help - by k776 on 09-10-2004 at 09:37 PM
RE: php coding help - by WDZ on 09-11-2004 at 03:08 AM
RE: php coding help - by Eljay on 09-11-2004 at 06:38 AM
RE: php coding help - by k776 on 09-13-2004 at 09:37 AM
RE: php coding help - by Eljay on 09-13-2004 at 04:32 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On