Jump to content

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


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

?>

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.