我有一个主要和次要网页。主页面具有用户最初输入信息的输入。辅助页面给我一个mysql值列表。我希望我的用户能够单击其中一个值的链接,并使用正确输入中返回的值打开主页面。有没有办法点击一个href链接并让主页面输入拿起php变量?主页面输入已经回显正确的变量。目前,如果选择了链接,则会打开主页面,而输入中没有任何数据。非常感谢任何帮助,到目前为止我的代码如下:
value="<?php echo htmlspecialchars($d_id); ?>" //example input value on primary page
function submit_form() //javascript
{
document.getElementById("submitform").submit();
}
// PHP
$creationdate = 'September 2015';
$sql = $conn->prepare("SELECT * FROM Shop_Information WHERE creation_date=? ORDER BY shop_id DESC") or die(mysqli_error($sql->db_link));
$sql->bind_param('s', $creationdate);
$sql->execute();
$sql->store_result();
$num_of_rows=$sql->num_rows;
$sql->bind_result($col1, $col2, $col3, $col4, $col5, $col6, $col7, $col8, $col9, $col10, $col11, $col12, $col13, $col14, $col15, $col16, $col17, $col18, $col19, $col20, $col21, $col22, $col23, $col24, $col25, $col26, $col27, $col28, $col29, $col30, $col31, $col32, $col33, $col34, $col35, $col36, $col37, $col38, $col39, $col40, $col41, $col42, $col43);
echo "<b><th><font size='5'>All dealer Mystery Shops.</font></th></b>";
echo "<hr> <br>";
while($sql->fetch())
{
$d_region = $col3;
$d_zone = $col4;
$d_district = $col5;
$d_id = $col6;
$d_name = $col7;
$d_url = $col8;
$d_num_1 = $col9;
$c_name = $col10;
$c_email = $col11;
$c_n_preferred = $col12;
$c_incentive1 = $col13;
$c_flag = $col14;
$l_name = $col15;
$c_date = $col16;
$s_date = $col17;
$d_called = $col18;
$t_called = $col19;
$c_q_1 = $col20;
$c_q_2 = $col21;
$c_q_3 = $col22;
$c_q_4 = $col23;
$c_q_5 = $col24;
$c_q_6 = $col25;
$c_q_7 = $col26;
$c_q_8 = $col27;
$c_q_9 = $col28;
$c_q_10 = $col29;
$c_q_11 = $col30;
$c_q_12 = $col31;
$c_q_13 = $col32;
$c_q_14 = $col33;
$c_q_15 = $col34;
$c_ec_1 = $col35;
$c_p_1 = $col36;
$c_p_2 = $col37;
$d_appt = $col38;
$t_appt = $col39;
$d_appt_cancelled = $col40;
$comments = $col41;
$c_q_16 = $col42;
$c_q_17 = $col43;
$shop_check = "update_shop";
$sh_id = $col1;
If($c_p_1 != "" && $c_p_2 != "")
{$c_p_1 = "Yes";}
elseif($c_p_1 == "" || $c_p_2 == "")
{$c_p_1 = "No";}
echo "<b>Dealer ID:</b> " . $d_id . " - <b>Dealer Name:</b> " . $d_name . " - <b>Mystery Shop ID:</b> " . $sh_id . " - <b>Graded?:</b> " . $c_p_1 . "<a href='/URL.php' id='submitform' onclick='submit_form();' target='_blank'>Select</a>" . "<br>";
}
答案 0 :(得分:0)
感谢大家的帮助,我明白了。下面的代码片段:
这是我用来将字符串发布到URL
的hrefecho "<b>Dealer ID:</b> " . "<a href='/URL.php?dealer_id=".$d_id."&dealer_url=".$d_url."&dealer_name=".$d_name."&Region=".$d_region."&RO_Open=".$d_zone."&RO_Number=".$d_district."&number1=".$d_num_1."&first_name=".$c_name."&customer_email=".$c_email."&number_preferred=".$c_n_preferred."&customer_incentive1=".$c_incentive1."&customer_flag=".$c_flag."&list_name=".$l_name."&creation_date=".$c_date."&sale_date=".$s_date."&date_called=".$d_called."&time_called=".$t_called."&call_question_1=".$c_q_1."&call_question_2=".$c_q_2."&call_question_3=".$c_q_3."&call_question_4=".$c_q_4."&call_question_5=".$c_q_5."&call_question_6=".$c_q_6."&call_question_7=".$c_q_7."&call_question_8=".$c_q_8."&call_question_9=".$c_q_9."&call_question_10=".$c_q_10."&call_question_11=".$c_q_11."&call_question_12=".$c_q_12."&call_question_13=".$c_q_13."&call_question_14=".$c_q_14."&call_question_15=".$c_q_15."&call_question_ec_1=".$c_ec_1."&call_penalties_1=".$c_p_1."&call_penalties_2=".$c_p_2."&date_appointment=".$d_appt."&time_appointment=".$t_appt."&date_appointment_cancelled=".$d_appt_cancelled."&comments=".$comments."&call_question_16=".$c_q_16."&call_question_17=".$c_q_17."&shop_type=".$shop_check."' target='_blank'>".$d_id."</a>" . " - <b>Dealer Name:</b> " . $d_name2 . " - <b>Mystery Shop ID:</b> " . $sh_id . " - <b>Graded?:</b> " . $c_p_3 . "<br>";
然后在我的主页面中,我使用以下内容进行评估,然后调用每个变量,以便我的POST仍然有效:
if(empty($_GET['dealer_id']) == FALSE)
{
$d_id = $_GET['dealer_id'];
etc,etc,etc
}