Mettre une chaîne de caractère contenant des espaces dans une value d'input

Résolu
SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention   -  
SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention   -
Bonsoir, je suis actuellement confronter un problème lors de la création de mon site.
Le problème étant que je souhaite utilisé dans la value d'un input un ensemble de mot du style "2 pain" : $Ingredient = ["Onigiri" => ["Ingredient" => ["2 cc de Riz", "Algue", "Poisson", "Eau"]]];

Mais quand j'utilise les valeur dans un input en temps que value cela donne uniquement le premier mot (2 pour le premier par exemple). Y'aurait-il moyen de régler ce problème ? Merci d'avance (;
A voir également:

2 réponses

jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   4 752
 
Bonjour,
Normalement il n'y a aucun souci pour utiliser des espaces dans des variables...
Mais.. Sans voir le code avec lequel tu essaies de remplir ton input .. impossible de t'aider !

NB: Pour poster ton code, merci d'utiliser les balises de code.
Explications ( à lire entièrement !! ) disponibles ici : https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code

0
SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention  
 
Voici le code et son résultat, en espérant que vous arriviez a me comprendre
Résultat ne prenant uniquement que le premier mot



Meilleur Salutation (:
0
SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention   > SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention  
 
 <!DOCTYPE html>
<html lang="fr">

<head>
    <!-- auteur: Alex (je vais éviter de partager mon nom sur le forum (x   )
    date: 08.05.2021
    version: v0.5
    projet : 5Gestion
    <title>GestionRecette</title>
    <meta charset="UTF-8">

</head>
<style>
    body {
        display: flex;
        align-items: center;
        flex-direction: column;
        justify-content: center;
        font-family: Calibri;
        background-image: url('../img/cute-rabbit-ice-cream-seamless-repeating-pattern-wallpaper-background-cute-seamless-pattern-background_42349-868.jpg');
        max-height: 100vh;
        min-height: 100vh;
             overflow: hidden;
    }

    main {

        background-color: rgba(255, 255, 255, 0.8);
        padding: 40px;
        border-left: 2px solid pink;
        border-right: 2px solid pink;
        box-shadow: 0px 0px 8px pink;
        margin-top: 10%;
        margin-bottom: 10%;
    }

    main>h2 {
        text-align: center;
    }

    h1 {
        text-shadow: 0px 0px 3px #FF00FF, 0px 0px 3px #FF00FF, 0px 0px 3px #FF00FF, 0px 0px 3px #FF00FF;
        background-color: #FFD4FF;
        padding: 20px;
        border-radius: 50px;
        color: white;
        box-shadow: 0px 0px 10px pink;
        font-size: 2rem;
        text-align: center;
        max-width: 20vw;
    }



    form {
        background-color: #EEE;
        padding: 30px;
        box-shadow: 0px 0px 10px #555;
        border-radius: 8px;
    }

    aside:first-child {
        overflow: scroll;
        overflow-x: hidden;
    }



    p input[type="submit"] {
        background-color: white;
        border-radius: 6px;
        font-family: Calibri;
        font-weight: bolder;
        text-transform: uppercase;
        font-size: 1rem;
        font-style: italic;
        width: 100%;
    }

    aside>input[type="text"] {
        background-color: white;
        border-radius: 6px;
        padding: 5px;
        font-family: Calibri;
        font-weight: bolder;
        text-transform: uppercase;
        font-size: 1rem;
        font-style: italic;

    }

    div {
        display: flex;
        flex-direction: row;
    }

    div>input[type="text"] {
        background-color: white;
        border-radius: 6px;
        padding: 5px;
        font-family: Calibri;
        font-weight: bolder;
        text-transform: uppercase;
        font-size: 1rem;
        font-style: italic;
        width: 91%;
    }




    div>input[type="submit"] {
        background-color: white;
        border-radius: 6px;
        padding-bottom: 6px;

        padding-top: 6px;
        font-weight: bolder;
        text-transform: uppercase;

        font-style: italic;
    }

    input[type="range"] {
        width: 184px;
    }

    span {
        margin-right: 80px;
    }

    input[type="submit"]:hover {
        background-color: #FFFAAD;
    }

    textarea {
        max-width: 99%;
        min-width: 99%;
        min-height: 250px;
        max-height: 250px;
        background-color: white;
        border-radius: 6px;
        float: right;
        padding-bottom: 6px;
        padding-top: 6px;
        font-weight: bolder;
        text-transform: uppercase;
        font-style: italic;
    }

    article {
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin-top: 2vh;

    }

    article img {
        float: left;
    }


    aside {
        padding: 40px;
        float: left;
        background-color: #EEE;
        padding: 30px;
        box-shadow: 0px 0px 10px #555;
        border-radius: 8px;
        max-width: 16vw;
        min-width: 16vw;
        max-height: 20vh;
    }



    aside {
        display: flex;
        flex-direction: column;

    }

    aside>p,
    aside>span {

        font-size: 1.1rem;
        font-weight: bold;
        font-style: italic;
        padding-left: 30px;

        max-width: 16vw;
        min-width: 16vw;

    }

    main>article:first-child {
        max-height: 1vh;
        overflow: scroll;
    }


    footer {
        font-style: italic;
        text-align: center;
        font-size: 0.9rem;
    }

    li {
        list-style: none;
    }
</style>






<body>
<?php $Ingredient = ["Onigiri" => ["Ingredient" => ["2 RizBrun", "20kg d'Algue", "Poisson", "Eau"]]]; ?>
<?php $Préparation = ["Onigiri" => ["Preparation" => ["Mettre dans de l'eau......"]]]; ?>


    <main>
        <form action="" method="POST" autocomplete="off">
            <h1>
                <?php foreach ($Ingredient as $key => $value) {
                    if ($key !== 0) {
                        echo $key;
                    }
                } ?>
            </h1>

            <p>
            <h2>Ingredient</h2>
            </p>

            <article>
                <aside>
                    <div>
                        <input type="text" name="AjoutIngredient" placeholder="ingredient">
                        <input name="+" type="submit" value="+">
                    </div>
                    <?php foreach ($Ingredient as $key => $value) {
                        foreach ($value as $key2 => $value2) {
                            foreach ($value2 as $key3 => $value3) { ?>
                                <input type="text" name="Ingre" value=<?php echo $value3 ?>>
                    <?php    }
                        }
                    }

                    ?>

                </aside>

            </article>

            <h2>Préparation</h2>
            <article>
                <aside> <?php
                        foreach ($Préparation as $key => $value) {
                            foreach ($value as $key2 => $value2) {
                                foreach ($value2 as $key3 => $value3) { ?>
                                <textarea name="Prepa"> <?php echo $value3 ?></textarea>
                    <?php  }
                            }
                        }
                    ?>
                </aside>

            </article>



            <footer>
                <p><input name="Modif" type="submit" value="Modification"></p>
            </footer>
        </form>
    </main>

</body>

</html>
0
jordane45 Messages postés 38486 Date d'inscription   Statut Modérateur Dernière intervention   4 752 > SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention  
 
Avec des quôtes ça marcherait mieux
value="<?php echo $value3; ?>">
0
SnifLePanda Messages postés 9 Date d'inscription   Statut Membre Dernière intervention  
 
Merci beaucoup, cela a résolue mon problème (:
0