Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

php - $_POST returns blank value

I want to return values from the selection I've made in the code below but it returns only a blank value in my SQL or even if I echo the $_POST. I think it has something to do with the fact that I echo my table in the code below. Could someone help me ?


<?php


function week($date){
$date1 = $date;
$date2 = date('Y-m-d',strtotime($date1 . "+1 days"));
$date3 = date('Y-m-d',strtotime($date1 . "+2 days"));
$date4 = date('Y-m-d',strtotime($date1 . "+3 days"));
$date5 = date('Y-m-d',strtotime($date1 . "+4 days"));
$date6 = date('Y-m-d',strtotime($date1 . "+5 days"));
$date7 = date('Y-m-d',strtotime($date1 . "+6 days"));


echo "<table>
<tr>
    <th>Numero</th>
    <th>" . $date1 ."</th>
    <th>" . $date2 ."</th>
    <th>" . $date3 ."</th>
    <th>" . $date4 ."</th>
    <th>" . $date5 ."</th>
    <th>" . $date6 ."</th>
    <th>" . $date7 ."</th>

</tr>";
}

function vendeur($vendeur){
    $date_1 = 'date1';
    $date_2 = 'date2';
    $date_3 = 'date3';
    $date_4 = 'date4';
    $date_5 = 'date5';
    $date_6 = 'date6';
    $date_7 = 'date7';

$rangee = '<tr><form method="post" action="envoiDonnees.php">';
$rangee .= '<td>' . $vendeur . '</td>';
$rangee .= '<td><select name="' . $date_1 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';

$rangee .='<td><select name="' . $date_2 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';
$rangee .='<td><select name="' . $date_3 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';
$rangee .='<td><select name="' . $date_4 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';
$rangee .='<td><select name="' . $date_5 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';
$rangee .='<td><select name="' . $date_6 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';
$rangee .='<td><select name="' . $date_7 .'">
                            <option value=""></option>
                            <option value="congé">Congé</option>
                            <option value="roulement">Roulement</option>
                            <option value="t?t">T?t</option>
                            <option value="tard">Tard</option>
                            <option value="inter">Inter</option>
                            <option value="Maladie">Maladie</option>
                            </select></td>';
$rangee .='<td><input type="submit" value="Modifier" /></td>';
$rangee .= "</tr>";

echo $rangee;
}
week('2021-01-01');
vendeur(3680);
vendeur(5786);
vendeur(2087);
vendeur(5802);
vendeur(1005);
vendeur(5788);

?>

I've been looking for a whole day about this issue but couldn't find a way to get it fixed.

Sorry for my bad English, I'm not a native speaker and I hope you guys can understand what I've been talking about.

I've been looking to create a weekly calendar for my team at work with this code. I'm still learning about PHP and have not a lot of practice so please forgive me.

Thanks for your help !!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...