Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> CNB Your Account
Author Message
prakas
New Member
New Member



Joined: Mar 22, 2005
Posts: 3

PostPosted: Thu Apr 21, 2005 2:00 am Reply with quote

Hi !

I am using CNB YA 440 b2 with PHPNUKE 7.5 patched 2.9 and I have added the following fields.
- Address 1
- Address 2
- Town
- Zip Code
- State
- Country

Now I would like to add these fields in the Feedback form (and others future forms) so when a registered member is logged the content of these new fields will be automatically displayed in the corresponding fields.

Thanks in advance for your help and Congratulations for your Good Job !
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Thu Apr 21, 2005 5:51 am Reply with quote

hi ,

well the feedback form doesnt use a database so added fields only reflect in the mail as extra info...

but perhaps this will help you...

the new feedback index.php...

Code:


<?php
if (!stristr($_SERVER['SCRIPT_NAME'], "modules.php")) {
    die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$index = 1;
$subject = "$sitename "._FEEDBACK."";
include("header.php");
$cookie[0] = intval($cookie[0]);
if ($cookie[1] != "") {
$row = $db->sql_fetchrow($db->sql_query("SELECT name, username, user_email FROM ".$user_prefix."_users WHERE user_id='$cookie[0]'"));
if ($row['name'] != "") {
$sender_name = $row['name'];
} else {
$sender_name = $row['username'];
}
$sender_email = $row['user_email'];
}
$form_block = "
<center><font class=\"title\"><b>$sitename: "._FEEDBACKTITLE."</b></font>
<br><br><font class=\"content\">"._FEEDBACKNOTE."</font>
<FORM METHOD=\"post\" ACTION=\"modules.php?name=$module_name\">
<P><strong>"._YOURNAME.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\" SIZE=30></p>
<P><strong>"._YOUREMAIL.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\" SIZE=30></p>
<P><strong>"._YOURADDRESS1.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_address1\" VALUE=\"$sender_address1\" SIZE=30></p>
<P><strong>"._YOURADDRESS2.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_address2\" VALUE=\"$sender_address2\" SIZE=30></p>
<P><strong>"._TOWN.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_town\" VALUE=\"$sender_town\" SIZE=30></p>
<P><strong>"._ZIPCODE.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_zipcode\" VALUE=\"$sender_zipcode\" SIZE=30></p>
<P><strong>"._STATE.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_state\" VALUE=\"$sender_state\" SIZE=30></p>
<P><strong>"._COUNTRY.":</strong><br>
<INPUT type=\"text\" NAME=\"sender_country\" VALUE=\"$sender_country\" SIZE=30></p>
<P><strong>"._MESSAGE.":</strong><br>
<TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=virtual>$message</TEXTAREA></p>
<INPUT type=\"hidden\" name=\"opi\" value=\"ds\">
<P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\""._SEND."\"></p>
</FORM></center>
";
OpenTable();
if ($opi != "ds") {
echo "$form_block";
} elseif ($opi == "ds") {
if ($sender_name == "") {
$name_err = "<center><font class=\"option\"><b><i>"._FBENTERNAME."</i></b></font></center><br>";
$send = "no";
}
if ($sender_email == "") {
$email_err = "<center><font class=\"option\"><b><i>"._FBENTEREMAIL."</i></b></font></center><br>";
$send = "no";
}
if ($message == "") {
$message_err = "<center><font class=\"option\"><b><i>"._FBENTERMESSAGE."</i></b></font></center><br>";
$send = "no";
}
if ($send != "no") {
$sender_name = removecrlf($sender_name);
$sender_email = removecrlf($sender_email);
$msg = "$sitename\n\n";
$msg .= ""._SENDERNAME.": $sender_name\n";
$msg .= ""._SENDEREMAIL.": $sender_email\n";
$msg .= ""._SENDERADDRESS1.": $sender_address1\n";
$msg .= ""._SENDERADDRESS2.": $sender_address2\n";
$msg .= ""._SENDERTOWN.": $sender_town\n";
$msg .= ""._SENDERZIPCODE.": $sender_zipcode\n";
$msg .= ""._SENDERSTATE.": $sender_state\n";
$msg .= ""._SENDERCOUNTRY.": $sender_country\n";
$msg .= ""._MESSAGE.": $message\n\n";
$to = $adminmail;
$mailheaders = "From: $sender_name <$sender_email>\n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail($to, $subject, $msg, $mailheaders);
echo "<P><center>"._FBMAILSENT."</center></p>";
echo "<P><center>"._FBTHANKSFORCONTACT."</center></p>";
} elseif ($send == "no") {
OpenTable2();
echo "$name_err";
echo "$email_err";
echo "$message_err";
CloseTable2();
echo "<br><br>";
echo "$form_block"; 
}
}
CloseTable();   
include("footer.php");

?>


and add these to your english language file..

Code:


define("_SENDERADDRESS1","Sender's Addres 1");
define("_SENDERADDRESS2","Sender's Address 2");
define("_SENDERTOWN","Sender's Town");
define("_SENDERZIPCODE","Sender's Zipcode");
define("_SENDERSTATE","Sender's State");
define("_SENDERCOUNTRY","Sender's Country");
 
View user's profile Send private message
prakas







PostPosted: Fri Apr 22, 2005 2:07 am Reply with quote

Thank you very much. I have added and adapted what you advised me. It's running but the result is not what I wish because the content of the added fields stays empty when a registered member is logged. Only the name and Email display the content...
As the datas : Address1, Adress2, Town, Zipcode, State ands Country belong to the 'nuke_cnbya_field' table I would like to know if it is possible to join this table with 'nuke_users' table in a request so we can display all these datas in the added fields.
I am a very neophyte in the PHP / MySQL Programming... I have many many thing to learn. But I tried to change the code by the following way. Naturally it doesn't run.... Whan I open the Feedback form all the fields are empty (even the name and email fields !).

----------------------------------------------
$row = $db->sql_fetchrow($db->sql_query("SELECT name, username, user_email FROM ".$user_prefix."_users WHERE user_id='$cookie[0]' and SELECT Address1, Address2, Town, Zipcode, State, Country FROM ".$user_prefix."_cnbya_field "));
if ($row['name'] != "") {
$sender_name = $row['name'];
} else {
$sender_name = $row['username'];
}
$sender_email = $row['user_email'];
$sender_address1 = $row['Addres1'];
$sender_address2 = $row['Addres2'];
$sender_town = $row['Town'];
$sender_zipcode = $row['Zipcode'];
$sender_state = $row['State'];
$sender_country = $row['Country'];
}
---------------------------------------------
This Feedback form will be use as a 'Sponsorship Application Form' which will be filled out by the registered members who want to sponsor very poor children in Himalaya...

Thanks in advance for your kind help.
 
hitwalker







PostPosted: Fri Apr 22, 2005 5:12 am Reply with quote

hi,

well at this point you have to add some fields to the database...
problem is,the mail is send using php mail mailfunction.
so i suggest adding the fields to your-account on signup form.
then you can use the same query to reflect the fields..
infact it sounds difficult but this could be very easy to do...
in the your-account the same stuff have to be added but also the fields in the table..
best would be if you had a testsite.
 
prakas







PostPosted: Fri Apr 22, 2005 6:06 am Reply with quote

Hi,

Thank you very much for your quick answer. I have already done what you advise me. I have installed CNB YOur Account 440 module and I have added these new fields in the admin of this module.
But the problem seems to be that the new fields datas are not located in a different table than 'nuke_users' table.
Name and email are in 'nuke_users' table and the new fields are in 'nuke_cnbya_field', one of the table created with the CNB YA 440 install....
Have I to add these new fields names :
- Address 1
- Address 2
- Town
- Zip Code
- State
- Country
in the 'nuke_users' table ?
Thank you very much in advance for your help.
 
hitwalker







PostPosted: Fri Apr 22, 2005 6:46 am Reply with quote

well every learning step is hard and usualy we fall..
anyway....
the best way to do this is to duplicate fields...
i also use cnbya your account and offers a lot of stuff that the member can fill in about themself.

so my guess is to add the extra fields to the your account database tables.
believe me,i cannot explain that by typing it here...
best for that is to contact member sixonetonoffun.
he knows most i think on the your-account mod.
so all there needs to be done is to add extra fields to the signup forum,then add the same extra fields to the your-account tables and add the query to the feedback form...its some work and also realise that updating your your-account mod in the future isnt that easy and have to be done manualy..
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> CNB Your Account

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©