Portail PHP

Forum de discussion et d'aide au php

Vous n'êtes pas identifié.

Annonce

Regles d'utilisation des forums : pensez à toujours les respecter si vous désirez obtenir des réponses rapides.
FAQ : pensez à toujours chercher dedans si la réponse à votre question est dedans.
Proposez vos news : si vous avez un evenement à annoncer
le chat : venez discuter de php.
 
  • Portail PHP
  •  » PHP - SQL
  •  » comment inserer un lien dans une balise de validation de formulaire

#1 10-01-2008 21:48:03

glassman
Membre
Date d'inscription: 10-01-2008
Messages: 1

comment inserer un lien dans une balise de validation de formulaire

je suis tres tres débutant en php.

j'ai un soucis sur lekel je trouve aucune solution.

voici la page globale (c un site en kite phpnuked)

Code:

<?php 
// -------------------------------------------------------------------------//
// Nuked-KlaN - PHP Portal                                                  //
// http://www.nuked-klan.org                                                //
// -------------------------------------------------------------------------//
// This program is free software. you can redistribute it and/or modify     //
// it under the terms of the GNU General Public License as published by     //
// the Free Software Foundation; either version 2 of the License.           //
// -------------------------------------------------------------------------//
if (!defined("INDEX_CHECK"))
{
    die ("<center>You cannot open this page directly</center>");
} 

global $nuked, $language, $user;
translate("modules/Recruit/lang/" . $language . ".lang.php");

opentable();

if (!$user)
{
    $visiteur = 0;
} 
else
{
    $visiteur = $user[1];
} 
$ModName = basename(dirname(__FILE__));
$level_access = nivo_mod($ModName);
if ($visiteur >= $level_access && $level_access > -1)
{
    compteur("Recruit");

    if ($nuked['recrute'] > 0)
    {
        function index()
        {
            global $nuked;

            if ($nuked['recrute_charte'] != "")
            {
                $charte = BBcode($nuked['recrute_charte']);
                $charte = icon($charte);

            echo "<br /><table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellspacing=\"1\" cellpadding=\"1\" border=\"0\">\n"
            . "<tr><td align=\"center\"><big><b>" . _RECRUIT . "</b></big></td></tr>\n"
            . "<tr><td>&nbsp;</td></tr><tr><td>" . $charte . "</td></tr></table>\n"
            . "<form method=\"post\" action=\"index.php?file=Recruit\">\n"
            . "<div style=\"text-align: center;\"><input type=\"hidden\" name=\"op\" value=\"form\" />\n"
            . "<input type=\"submit\" value=\"" . _IAGREE . "\" />&nbsp;<input type=\"button\" value=\"" . _IDESAGREE . "\" onclick=\"javascript:history.back()\" /></div></form>\n";

            } 
            else
            {
                form();
            } 
        } 

        function form()
        {
            global $nuked, $user, $language;

        echo "<script type=\"text/javascript\">\n"
        ."<!--\n"
        ."\n"
        . "function verifchamps()\n"
        . "{\n"
        . "if (document.getElementById('recruit_pseudo').value.length == 0)\n"
        . "{\n"
        . "alert('" . _NONICK . "');\n"
        . "return false;\n"
        . "}\n"
        . "\n"
        . "if (document.getElementById('recruit_lastname').value.length == 0)\n"
        . "{\n"
        . "alert('" . _NOLASTNAME . "');\n"
        . "return false;\n"
        . "}\n"
        . "\n"
        . "if (document.getElementById('recruit_age').value.length == 0)\n"
        . "{\n"
        . "alert('" . _NOAGE . "');\n"
        . "return false;\n"
        . "}\n"
        ."\n"
        ."if (document.getElementById('recruit_mail').value.indexOf('@') == -1)\n"
        ."{\n"
        ."alert('" . _BADMAIL . "');\n"
        ."return false;\n"
        ."}\n"
        ."\n"
    . "if (document.getElementById('recruit_icq').value.length == 0)\n"
    . "{\n"
    . "alert('" . _NOICQ . "');\n"
       . "return false;\n"
    . "}\n"
        ."\n"
        . "return true;\n"
        . "}\n"
        ."\n"
        . "// -->\n"
        . "</script>\n";


    echo "<br /><form method=\"post\" action=\"index.php?file=Recruit\" onsubmit=\"return verifchamps();\">\n"
    . "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellspacing=\"1\" cellpadding=\"1\" border=\"0\">\n"
    . "<tr><td colspan=\"2\" align=\"center\"><big><b>" . _RECRUIT . "</b></big></td></tr><tr><td colspan=\"2\">&nbsp;</td></tr>\n"
    . "<tr><td style=\"width: 20%;\"><b>" . _NICK . " : </b></td><td><input id=\"recruit_pseudo\" type=\"text\" name=\"pseudo\" value=\"" . $user[2] . "\" size=\"20\" /></td></tr>\n"
    . "<tr><td style=\"width: 20%;\"><b>" . _FIRSTNAME . " : </b></td><td><input id=\"recruit_lastname\" type=\"text\" name=\"prenom\" size=\"20\" /></td></tr>\n"
    . "<tr><td style=\"width: 20%;\"><b>" . _AGE . " : </b></td><td><input id=\"recruit_age\" type=\"text\" name=\"age\" size=\"3\" /></td></tr>\n"
    . "<tr><td style=\"width: 20%;\"><b>" . _MAIL . " : </b></td><td><input id=\"recruit_mail\" type=\"text\" name=\"mail\" size=\"25\" /></td></tr>\n"
    . "<tr><td style=\"width: 20%;\"><b>" . _ICQMSN . " : </b></td><td><input id=\"recruit_icq\" type=\"text\" name=\"icq\" size=\"25\" /></td></tr>\n"
    . "<tr><td style=\"width: 20%;\"><b>" . _COUNTRY . " : </b></td><td><select name=\"country\">\n";

        if ($language == "french")
        {
            $pays = "France.gif";
        } 

        $rep = Array();
        $handle = @opendir("images/flags");
        while (false !== ($f = readdir($handle)))
        {
            if ($f != ".." && $f != "." && $f != "index.html" && $f != "Thumbs.db")
            {
                $rep[] = $f;
            }
    }

        closedir($handle);
    sort ($rep);
    reset ($rep);

    while (list ($key, $filename) = each ($rep)) 
    {
            if ($filename == $pays)
            {
                $checked = "selected=\"selected\"";
            } 
            else
            {
                $checked = "";
            } 

            list ($country, $ext) = split ('[.]', $filename);
            echo "<option value=\"" . $filename . "\" " . $checked . ">" . $country . "</option>\n";
    } 

            echo "</select></td></tr><tr><td style=\"width: 20%;\"><b>" . _GAME . " : </b></td><td><select name=\"game\">\n";

            $sql = mysql_query("SELECT id, name FROM " . GAMES_TABLE . " ORDER BY name");
            while (list($game_id, $nom) = mysql_fetch_array($sql))
            {
                $nom = stripslashes($nom);
                $nom = htmlentities($nom);
                echo "<option value=\"" . $game_id . "\">" . $nom . "</option>\n";
            } 

            echo "</select></td></tr><tr><td style=\"width: 20%;\"><b>" . _CONNECT . " : </b></td><td><select name=\"connex\">\n"
            . "<option>" . _56K . "</option>\n"
            . "<option>" . _NUMERIS . "</option>\n"
            . "<option>" . _ADSL . "</option>\n"
            . "<option>" . _CABLE . "</option>\n"
            . "<option>" . _T1 . "</option>\n"
            . "</select></td></tr><tr><td style=\"width: 20%;\"><b>" . _EXPERIENCE . " : </b></td><td><select name=\"exp\">\n"
            . "<option>" . _LESS1MONTH . "</option>\n"
            . "<option>" . _LESS6MONTH . "</option>\n"
            . "<option>" . _LESS1YEAR . "</option>\n"
            . "<option>" . _MORE1YEAR . "</option>\n"
            . "<option>" . _MORE2YEAR . "</option>\n"
            . "</select></td></tr><tr><td style=\"width: 20%;\"><b>" . _AVAILABLE . " : </b></td><td><select name=\"dispo\">\n"
            . "<option>" . _EVENING . "</option>\n"
            . "<option>" . _WEEKEND . "</option>\n"
            . "<option>" . _HOLIDAY . "</option>\n"
            . "<option>" . _THREE . "</option>\n"
            . "<option>" . _OTHER . "</option>\n"
            . "</select></td></tr><tr><td style=\"width: 20%;\"><b>" . _COMMENT . " : </b></td><td><textarea name=\"comment\" cols=\"60\" rows=\"10\"></textarea></td></tr><tr><td colspan=\"2\">&nbsp;</td></tr>\n"
            . "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"" . _SEND . "\" /><input type=\"hidden\" name=\"op\" value=\"send_recruit\" /><input type=\"hidden\" name=\"op\" value=\"send_recruit\" /></td></tr></table></form><br />\n";
        } 

        function send_recruit($pseudo, $prenom, $age, $mail, $icq, $country, $game, $connex, $exp, $dispo, $comment)
        {
            global $nuked;

            $inbox = $nuked['recrute_inbox'];
            $email = $nuked['recrute_mail'];
            $date = time();
            $date2 = strftime("%x %H:%M", $date);

            $pseudo = addslashes($pseudo);
            $prenom = addslashes($prenom);
            $age = addslashes($age);
            $mail = addslashes($mail);
            $icq = addslashes($icq);
            $country = addslashes($country);
            $connex = addslashes($connex);
            $exp = addslashes($exp);
            $dispo = addslashes($dispo);
            $comment = addslashes($comment);

            $pseudo = htmlentities($pseudo);
            $prenom = htmlentities($prenom);
            $age = htmlentities($age);
            $mail = htmlentities($mail);
            $icq = htmlentities($icq);
            $country = htmlentities($country);
            $connex = htmlentities($connex);
            $exp = htmlentities($exp);
            $dispo = htmlentities($dispo);
            $comment = htmlentities($comment);

            $sql = mysql_query("INSERT INTO " . RECRUIT_TABLE . " ( `id` , `date` , `pseudo` , `prenom` , `age` , `mail` , `icq` , `country` , `game` , `connection` , `experience` , `dispo` , `comment` ) VALUES ( '' , '" . $date . "' , '" . $pseudo . "' , '" . $prenom . "' , '" . $age . "' , '" . $mail . "' , '" . $icq . "' , '" . $country . "' , '" . $game . "' , '" . $connex . "' , '" . $exp . "' , '" . $dispo . "' , '" . $comment. "' )");

            $subject = _RECRUIT . ", " . $date2;
            $corps = $pseudo . " " . _NEWRECRUIT . "\r\n" . $nuked['url'] . "/index.php?file=Recruit&page=admin\r\n\r\n\r\n" . $nuked['name'] . " - " . $nuked['slogan'];
            $from = "From: " . $nuked['name'] . " <" . $nuked['mail'] . ">\r\nReply-To: " . $mail;

            $subject = @html_entity_decode($subject);
            $corps = @html_entity_decode($corps);
            $from = @html_entity_decode($from);

            if ($email != "")
            {
                mail($email, $subject, $corps, $from);
            } 
            if ($inbox != "")
            {
                $sql2 = mysql_query("INSERT INTO " . USERBOX_TABLE . " ( `mid` , `user_from` , `user_for` , `titre` , `message` , `date` , `status` ) VALUES ( '' , '" . $inbox . "' , '" . $inbox . "' , '" . $subject . "' , '" . $corps . "' , '" . $date . "' , '0' )");
            } 

            echo "<br /><br /><div style=\"text-align: center;\">" . _SENDRECRUIT . "</div><br /><br />";
            redirect("index.php", 2);
        } 

        switch ($op)
        {
            case"index":
                index();
                break;

            case"form":
                form();
                break;

            case"send_recruit":
                send_recruit($pseudo, $prenom, $age, $mail, $icq, $country, $game, $connex, $exp, $dispo, $comment);
                break;

            default:
                index();
                break;
        } 
    } 
    else
    {
        echo "<br /><br /><div style=\"text-align: center;\">" . _RECRUITOFF . "</div><br /><br />";
    } 

} 
else if ($level_access == -1)
{
    echo "<br /><br /><div style=\"text-align: center;\">" . _MODULEOFF . "<br /><br /><a href=\"javascript:history.back()\"><b>" . _BACK . "</b></a></div><br /><br />";
} 
else if ($level_access == 1 && $visiteur == 0)
{
    echo "<br /><br /><div style=\"text-align: center;\">" . _USERENTRANCE . "<br /><br /><b><a href=\"index.php?file=User&amp;op=login_screen\">" . _LOGINUSER . "</a> | <a href=\"index.php?file=User&amp;op=reg_screen\">" . _REGISTERUSER . "</a></b></div><br /><br />";
} 
else
{
    echo "<br /><br /><div style=\"text-align: center;\">" . _NOENTRANCE . "<br /><br /><a href=\"javascript:history.back()\"><b>" . _BACK . "</b></a></div><br /><br />";
} 

closetable();

?>

dans l'ensemble de cette page, je cherche a inserer (en plus de la confirmation du formulaire et de l'envoie des donner) un lien vers le forum.

cela se trouve dans cette partie (ligne 178) :

Code:

. "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"" . _SEND . "\" /><input type=\"hidden\" name=\"op\" value=\"send_recruit\" /></td></tr></table></form><br />\n";

c ici ke j'aimerais en plus du "hidden", ajouter un lien pour basculer vers une zone de mon forum.
c une adresse de type "http://monsite/index.php?file=Forum&page=viewforum&forum_id=2"

j'ai cherche sur plein de site, mais j'ai rien trouver.

Hors ligne

 

#2 20-01-2008 11:06:03

dechichulien
Membre
Lieu: strasbourg
Date d'inscription: 29-11-2007
Messages: 48
Site web

Re: comment inserer un lien dans une balise de validation de formulaire

slt, je n'est pas trop compris ce que tu veut mais si c'est ce que je pence, remplace ta ligne par sa :

Code:

. "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"" . _SEND . "\" /><input type=\"hidden\" name=\"op\" value=\"send_recruit\" /></td></tr><br><a href=\"http://monsite/index.php?file=Forum&page=viewforum&forum_id=2\">RETOUR AU FORUM</a></table></form><br />\n";

Dernière modification par dechichulien (20-01-2008 11:06:34)

Hors ligne