Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yesudo.com
Forum Newbie
Posts: 1
Joined: Tue Feb 17, 2004 7:12 pm
Location: London

Help

Post by yesudo.com »

Hello,

THE SECOND FUNCTION BELOW IS NOT BEING RECOGNISED - error message function not defined - anyone know what I am doing wrong or if i need to edit another file? THANX.

BACKGROUND: I am adding a new field to the customer create account process(oScommerce) asking them where they heard about us and they can choose from a list of options.

FIRST FUNCTION CALL: - file create_account.php

<?php echo tep_get_source_list('source') . '&nbsp;' . (tep_not_null(ENTRY_SOURCE_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_TEXT . '</span>': ''); ?>

FIRST FUNCTION DEFINITION AND SECOND FUNCTION CALL: - file includes/functions/html_output.php


////
// Creates a pull-down list of customer_sources
function tep_get_source_list($name, $selected = '', $parameters = '') {
$sources_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$sources = tep_get_sources();

for ($i=0, $n=sizeof($sources); $i<$n; $i++) {
$sources_array[] = array('id' => $sources[$i]['source_id'], 'text' => $sources[$i]['source_name']);
}

return tep_draw_pull_down_menu($name, $sources_array, $selected, $parameters);
}

SECOND FUNCTION DEFINITION:file includes/functions/general.php


////
// Returns an array with source
// TABLES: customer_source function tep_get_sources($source_id='')
{

$sources_array = array();

if (tep_not_null($source_id))
{

$sources = tep_db_query("select source_name from " . TABLE_CUSTOMER_SOURCE . " where source_id = '" . (int)$source_id . "'");

$sources = tep_db_fetch_array($sources);
$sources_array = array('source_name' => $sources_values['source_name']);

}
else
{

$sources = tep_db_query("select source_id, source_name from " . TABLE_CUSTOMER_SOURCE . " order by source_name");

while ($sources_values = tep_db_fetch_array($sources))
{

$sources_array[] = array('source_id' => $sources_values['source_id'],

'source_name' => $sources_values['source_name']);

}

}


return $sources_array;

}
Post Reply