why html-form-guide.com form throws following error?

When I run following php script it throws this error message: "Variable $pub_id is not set. Non-existent. Therefor, you cannot search with it"

---------------------------------------------php script--------------------------------------

Run this script:

<?php

require_once( "./include/fgcontactform.php" );

require_once( "./include/captcha-creator.php" );

$formproc = new FGContactForm();

$captcha = new FGCaptchaCreator('scaptcha');

$formproc->EnableCaptcha($captcha);

if(!isset($pub_id)){

die('<h3>Variable $pub_id is not set. Non-existent. Therefor, you cannot search with it.</h3>');

}

$r = mysql_query("SELECT * FROM publishers WHERE pubid='{$pub_id}' LIMIT 1") or die('Query Error: ' . mysql_error());

if( mysql_num_rows($r) === 0){

die('<h3>A publisher with the pubid of [' . $pub_id . '] was not found. Cannot add, what I do not have.</h3>');

}

$public_email = mysql_fetch_object( $r )->public_email;

echo '<h3>Public Email: [' . $public_email . ']</h3><br>';

if( strlen($public_email) > 0){

$formproc->AddRecipient( $public_email );

}else{

die('<h3>No Email address to add.</h3>');

}

?>

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

and also it echo (by retrieving email id from mysql table) this part of the php script:

echo '<h3>Public Email: [' . $public_email . ']</h3><br>';

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

i'm really confused.

BTW im using html-form-guide.com/contact-form to let visitors of my website contact me or several publishers who publish on my website.

1 Answer

Relevance
  • Gitlez
    Lv 6
    9 years ago
    Favorite Answer

    Sorry Mike, when I posted that, I assumed you would insert it into the relevant part of the script.

    There needs to be a point where you set $pub_id, before you use it in your SQL statement.

    You can always send me the original script, and I'll take a look at it and fix it. As well as telling you why is wasn't working the way you thought it would.

    Cheers,

    Gitlez

Still have questions? Get your answers by asking now.