Jump to content

Can Not Perform The New Script


yangkai9999
 Share

Recommended Posts

Hello,bellow are my test PHP codes.the first one is used to get a pull down list from exist mysql table and pass a selected value to a post variable and perfrom the next PHP code. when click go button. it seems work (not sure, but no error message come out when I run the code).the second code is used to present the values by using the difference method to transfer. The problem is that can not go to the next page and stay at the current page.Where is the wrong?Thanks,code 1:<?phpmysql_connect("localhost","root","*****");mysql_select_db("mytest") or die( "Unable to select database/ this is my note");echo "<form action='./update2.php' method='post'>"; echo "Please choose a patient for update:  "; echo "<select id='num' Onchange='changeLocation(this)' name=getid>"; echo "<option selected >"; $i=0; $query="SELECT p_id from mytest.p2 order by P_ID;"; $results = mysql_query($query) or die('no such table exist ' . mysql_error());; while ($row=mysql_fetch_row($results)) { if ($i == 0) { $i++; echo "<option value='p_id=$row[0]'>$row[0] </option>"; } else { echo "<option value='p_id=$row[0]'>$row[0]</option>"; echo "$row[0]"; } } echo "</select>"; echo "<input type='submit' name='go' value='go'>";echo "</form>";++$i;?>second one:<?php$p_id = $row[0];$p_id2= $_get($getid);$p_id3= $_post($getid);echo $p_id ;echo $p_id2 ;echo $p_id3 ;?>

Link to comment
Share on other sites

Add this to the top of all of your pages:

ini_set('display_errors', 1);error_reporting(E_ALL);

On the second page $row does not exist, $row only exists on the first page. Also, you need to use $_GET and $_POST, not $_get and $_post. You can use print_r to see the contents of an array:print_r($_GET);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...