使用http GET php从数组中获取一个元素

时间:2021-04-01 13:38:38

I'm using a form in a html document an I have this input:

我在html文档中使用了一个表单,我有这个输入:

<input type="hidden" name="codigo">
   <xsl:attribute name="value">
       <xsl:value-of select="codi"/>
   </xsl:attribute>
</input>

For example if I press the submit button in the URL I see: ?codigo=4, in my php code I am adding a child "comentario" in a document.xml for a select finca:

例如,如果我按下URL中的提交按钮,我看到:?codigo = 4,在我的php代码中,我在document.xml中为select finca添加了一个子“comentario”:

$finca = $fincas->finca[$_GET['codigo']]->comentarios->addChild('comentario');

The question is that my server can not process the $_GET parameter into an array and I need to add the child in a specific finca. I tried to do it with a fixed parameter like '1' and it's working.

问题是我的服务器无法将$ _GET参数处理成数组,我需要在特定的finca中添加子项。我尝试使用像'1'这样的固定参数来做它并且它正在工作。

Is there any solution to solve it?

有什么解决方案可以解决吗?

1 个解决方案

#1


0  

ok, after looking a long time I found a very easy solution, is to do a Parse int, (int)

好吧,看了很久之后我找到了一个非常简单的解决方案,就是做一个Parse int,(int)

#1


0  

ok, after looking a long time I found a very easy solution, is to do a Parse int, (int)

好吧,看了很久之后我找到了一个非常简单的解决方案,就是做一个Parse int,(int)