dsaf415212 2014-02-25 14:14
浏览 56

每个复选框的多个值

I have a website which displays images from my database.

I echo the images using PHP and have a checkbox echoed below each image.

If the checkbox is ticked, and the form is submitted, the 'action' page will get the image name from the value of the checkbox - the value of the checkbox is the image name.

This is working great.

My code is:

I get my image name using...

$image_name = $fetch['image_name'];

I add the tick box and array below, as such...

(Don't forget, I am echoing all images from database so I need an array to determin which image is selected/ticked)

<input name="image[]" type="checkbox" value="'.$image_name.'" />

This gets the images name so I am able to echo the image name on the 'action' page.

My problem is...

I also need to have another checkbox (or 2) for image sizes (6x4, 7x5) etc.

I am unable to pass the 'value' of the size and the 'value' of the image name using a single checkbox!

Any ideas or advice?

  • 写回答

1条回答 默认 最新

  • duan205571 2014-02-25 14:23
    关注

    If You have ID of image You can do that:

    <input name="image['.$imageID.']['6x4']" type="checkbox" value="'.$image_name.'" />
    <input name="image['.$imageID.']['7x5']" type="checkbox" value="'.$image_name.'" />
    

    On action side You will use foreach to get names and sizes.

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法