【发布时间】:2022-11-12 16:55:57
【问题描述】:
Hello, I am a beginner in laravel. I want to implement a feature that I detail below:
I want to use laravel 8 and php :
1/ Select a part of the data in a table (via a select)
- how to get the id selected in the select
2/ Copy the data and insert it in another table (via an add button)
- how to recover the id present in the url of the page
3/ Display the data inserted in a table
- no problem
`
<select name="id_segment" class="form-control">
<?php
$req1 = DB::select("SELECT id_segment, nom_segment FROM `segements` ");
foreach ($req1 as $re1 => $r1) {
?>
<option name="id_segment" value="{{ $r1->id_segment }}"> {{ $r1->id_segment }}
{{ $r1->nom_segment }}</option>
<?php
} ?>
</select>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 text-center">
<button type="submit" class="btn btn-primary" id="AjoutSegment">Ajouter</button>
<a class="btn btn-primary" href="{{ route('groupecampagnes.index') }}"> Back</a>
</div>
`
我已经在制作 var_dump 时尝试过使用 $_POST 和 $_GET,但我看到有些人说它不起作用,它给了我一个错误,显示我试图准确恢复的 id,而它应该只是在页面上显示给我看我是否能很好地和真实地恢复它。 var_dump 不存在于代码中,因为我同时删除了它。在我尝试了在网上找到的各种解决方案之后,这些解决方案让我将其中一些与 std 类对象有关的错误显示为错误。
【问题讨论】:
-
请阅读 markdown guide 并解决你的问题,它在当前状态下是不可读的。