Aggiungere nuovo controllo

Pieroso

Nuovo Utente
26 Set 2012
1
0
0
Salve a tutti, premetto che mastico un pochino di php e nulla di java, ho però assoluto bisogno di modificare un form in php in cui viene fatto un controllo di validità in JavaScript su due campi. Di preciso: devo ricavare il valore del primo campo (numerico) e confrontarlo con una variabile estratta da un database in base al valore del secondo campo (testo).
Spero proprio di essermi fatto capire e che qualcuno mi aiuti.

Questo è il codice da modificare:
PHP:
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$new_total = "";
?>
<script type="text/javascript">
<!--
function validateForm( frm ) {
var valid = document.formvalidator.isValid(frm);
if (valid == false) {
// do field validation
if (frm.numpoints.invalid) {
alert( "<?php echo JText::_( 'AUP_NUMPOINTS' );?>" );
} else if (frm.username2points.invalid) {
alert( "<?php echo JText::_( 'AUP_USERNAME', true ); ?>" );
}
return false;
} else {
frm.submit();
}
}
// -->
</script>
<?php if ( $this->params->get( 'show_page_title', 1 ) ) { ?>
<div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<?php echo $this->params->get( 'page_title' ); ?>
</div>
<?php } ?>
<?php
if ( $this->params->def( 'limitdonationpoints', 0 ) ) {
$percent = $this->params->get( 'limitdonationpoints' );
// limit the number of points a user can be redistribute to another user
$new_total = $this->currenttotalpoints - intval( ($this->currenttotalpoints*$percent)/100 );
echo JText::_( 'AUP_THE_NUMBER_OF_POINTS_TO_DONATE_IS_LIMITED' ) . " " . $new_total . " " . JText::_( 'AUP_POINTS' );;
} else echo JText::_('AUP_DONATEPOINTSTOFRIEND') ;
?>
<br /><br />
<form action="<?php echo JRoute::_( 'index.php' );?>" method="post" name="sendPointsForm" id="sendPointsForm" class="form-validate">
<table class="contentpaneopen<?php echo $this->params->get( 'pageclass_sfx' ); ?>">
<tr>
<td width="180">
<?php echo JText::_( 'AUP_NUMPOINTS' ); ?>
</td>
<td>
<input class="inputbox required" type="text" name="numpoints" id="numpoints" size="10" maxlength="255" value="" /> /
<?php
if ( $this->params->get( 'limitdonationpoints' ) ) {
echo $new_total . " " . JText::_( 'AUP_POINTS' );
echo " <i>(" . sprintf(JText::_( 'AUP_YOURCURRENTTOTALPOINTS' ), $this->currenttotalpoints ) . ")</i>";
$this->currenttotalpoints = $new_total;
} else {
echo $this->currenttotalpoints . " " . JText::_( 'AUP_POINTS' );
}
?>
</td>
</tr>
<tr>
<td>
<?php echo JText::_( 'AUP_USERNAMEOFYOURFRIEND' ); ?>:
</td>
<td>
<input class="inputbox required" type="text" name="username2points" id="username2points" size="30" maxlength="255" value="" /> <span id="statusUSR"></span>
</td>
</tr>
</table>
<button class="button validate" type="submit"><?php echo JText::_('AUP_SEND'); ?></button>
<input type="hidden" name="option" value="com_alphauserpoints" />
<input type="hidden" name="view" value="user2userpoints" />
<input type="hidden" name="referreid" value="<?php echo $this->referreid; ?>" />
<input type="hidden" name="userid" value="<?php echo $this->userID; ?>" />
<input type="hidden" name="currenttotalpoints" value="<?php echo $this->currenttotalpoints; ?>" />
<input type="hidden" name="menuid" value="<?php echo $this->menuid; ?>" />
<input type="hidden" name="task" value="sendpoints" />
<br />
<br />
<input type="button" value="Stampa l'Assegno" onclick="document.location = 'http://www.lirex.it/index.php?option=com_chronoforms&chronoform=stampabuono';">
<br />
<br />
<?php {
echo "ULTIMA OPERAZIONE EFFETTUATA CORRETTAMENTE:";
} ?>
<br />
<br />
<?php
$user =& JFactory::getUser();
// interrogare il DB:
$db =& JFactory::getDBO();
$query = "SELECT * FROM psl_alpha_userpoints_details WHERE datareference LIKE'%".$user->username."%' and points>0 ORDER BY `id` DESC";
$db->setQuery($query);
$row = $db->loadAssoc();
$venditore=$row['referreid'];
$importo=$row['points'];
$id=$row['id'];

{
echo "Importo Assegno in Lirex: ";

}
{
echo $importo;
}
?>
<br />
<?php
{
echo "Venduto da: ";

}
{
echo $venditore;
}
?>
</form>

Vi ringrazio anticipatamente.
piero
 
Ultima modifica di un moderatore:

borgo italia

Super Moderatore
Membro dello Staff
SUPER MOD
MOD
4 Feb 2008
16.046
150
63
PR
www.borgo-italia.it
ciao
racchiudete sempre il codice tra gli opportuni tag (seconda riga formattazione del post, ultime tre iconcine, nell'ordine CODE HTML PHP).
 
Discussioni simili
Autore Titolo Forum Risposte Data
filippino Aggiungere nuovo font in Photoshop Photoshop 1
C Aggiungere un nuovo elemento ad un Array PHP 0
W Aggiungere un nuovo campo input per fare una ricerca in base al numero che inserisci Classic ASP 26
I aggiungere la sessione PHP 8
K [PHP] Aggiungere caratteri ad una stringa in base alla lunghezza della stessa PHP 2
E Aggiungere Parole PHP 1
A aggiungere stringa all'inizio di ogni riga di un file txt PHP 3
MarcoGrazia Aggiungere o rimuovere classi in javascript Javascript 1
F Aggiungere automaticamente sito a home del telefono HTML e CSS 2
C Aggiungere blocco dati Javascript 6
F [PHP] Aggiungere ruolo per accedere alle pagine PHP 2
Cosina Aggiungere pulsante pause/play a slideshow Javascript 0
A Twitter aggiungere tweet a campagna esistente o salvare pubblico Social Media Marketing 0
S aggiungere colonna date in una tabella già esistente Database 0
P [PHP] Aggiungere un mio script a prestashop? PHP 10
Shyson [PHP] Aggiungere link al codice PHP 0
D Aggiungere file .css esterno su Android HTML e CSS 4
R [PHP] Aggiungere 90 minuti a stringa orario PHP 1
brasoft2019 [PHP] aggiungere timestamp in tabella correlata PHP 0
P [PHP] Aggiungere giorni e stampare risultato da data inserita in input PHP 3
L [Java] Aggiungere elementi ad array JSON Java 0
F [WordPress] [HTML] Aggiungere una pagina solo allo sticky menu WordPress 4
C [PHP] Aggiungere pulsante paypal PHP 2
M [javascript] Aggiungere eventi al caricamento Javascript 0
M aggiungere streaming audio a pagina html HTML e CSS 2
trattorino [PHP] sql aggiungere dato in una tabella senza cancellare contenuto PHP 6
Francesco Oliviero Aggiungere comando a pulsante HTML HTML e CSS 1
felino [WordPress] [WooCommerce] Ordine: aggiungere nuovi stati con notifica email al cliente WordPress 4
L [Photoshop] Aggiungere file video in timeline Photoshop 1
D [Photoshop] aggiungere piu tracce a immagine Photoshop 4
D Aggiungere slash finale ad URL con .htaccess Web Server 2
G [Javascript] aggiungere sub-namespace Javascript 0
L Aggiungere contenuto con ajax durante lo scroll jQuery 1
felino [WordPress] [Woocommerce] Aggiungere un costo addizionale per prodotto WordPress 0
G [RISOLTO][Javascript] aggiungere elemento ad array definito nella finestra madre da popup Javascript 4
elpirata Aggiungere un disco ssd separato dal raid 1 Hardware 0
S (VENDO) Possiamo aggiungere fino a 20000 Membri nei Gruppi Facebook Italiani Annunci servizi di Social Media Marketing 2
trattorino [PHP] aggiungere html in un codice PHP 0
otto9due Aggiungere n. giorni ad una data nel datepiker jQuery 4
R [HTML] Aggiungere una tabella a fianco di altre tabelle... HTML e CSS 6
F aggiungere codice dopo n elementi jquery jQuery 1
L [Javascript] Aggiungere una riga ad una tabella Javascript 5
asevenx [Javascript] aggiungere righe con select da database e calcolo sconto in automatico Javascript 0
Monital [Javascript] decidere dove aggiungere il campo dinamicamente Javascript 1
asevenx [Javascript] aggiungere dinamicamente un campo di un form Javascript 3
ACarty [Javascript] Aggiungere link alle foto. Javascript 19
matteoraggi Aggiungere filtri a woocommerce WordPress 0
S appinventor, aggiungere tasto registrazione Sviluppo app per Android 1
V Aggiungere un img nel background Sviluppo app per Android 1
felino Capability: aggiungere cap all'editor per admin.php?page WordPress 0

Discussioni simili