Jump to content

[SOLVED] If get returns result insert to db else do not?


dropfaith

Recommended Posts

im sure i cant be too far off but this doesnt work properly i submits to the database no matter what

 

 

<input type="hidden" name="referral" value="ImagesByTroy" />would submit the form to the database

but

<input type="hidden" name="referral" value="" />Would not

 

referral is a hidden form field that uses get from the previous page to populate

 

 

<?php

	if(!is_array($_GET['referral']))
{
	include("../client/header.php");
    // set up error list array
    $errorList = array();
    $count = 0;
    // validate text input fields
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$Earned = $_REQUEST['Earned'] ;
$Billed = $_POST['Billed'];
$Name = $_REQUEST['name'];
$Referral = $_REQUEST['referral'];
$Email = $_POST['email'];
    // check for errors
    // if none found...
  
        // generate and execute query
        $query = "INSERT INTO referrals (Referral, Name, Billed, Earned, Email) VALUES('$Referral','$Name','0','0','$Email')";
        $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
        echo "<p>Update successful.<a href=index.php>Go Home</a>.<br /></p>";
        // close database connection
        mysql_close($connection);

}
else
{
//special circumstance

}

// includes

?>

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.