|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
Passing $_POST data with postfield (was: Hi...desperately need help)
hello there,
i just started doing some programming in wml. actually, iv almost completed some work on a web site, and right now im just converting it to wml. im getting problems with $_POST, i never actually get the values. in one of them, when im executing a query, instead of having a value( i tried to print it to check) i only get the variable names. im posting one bmi checker, it doesnt need any database tables. im getting a division by zero error, maybe because i didnt pass the variables well...could you have a look at it? thanks a lott, yuk****a php Code:
Last edited by jabba_29 : February 28th, 2007 at 09:31 AM. |
|
#2
|
|||
|
|||
|
well, that wasnt me using s word, thats just my name,
sunyukta... |
|
#3
|
||||
|
||||
|
Hi sunyukta, welcome to Devshed.
I think it may be failing because you are printing out the second card before the form has been posted.... You could try something like: PHP Code:
Also note that you WML output is invalid and will break on a real phone.
__________________
Cheers, Jamie # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. ![]() __________________ |
|
#4
|
|||
|
|||
|
it works
hi , thanks...
im getting problems with $_POST[]...when im using postfield, say for a numeric field, when im using them in a query, im only getting the field name... im posting some of my code <?php $conn_clinic = mysql_pconnect("localhost", "clinic", "") or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_conn_clinic, $conn_clinic); $query_rsdept = "SELECT departments.Departmentno, departments.Departmentname FROM departments"; $rsdept = mysql_query($query_rsdept, $conn_clinic) or die(mysql_error()); $row_rsdept = mysql_fetch_assoc($rsdept); $totalRows_rsdept = mysql_num_rows($rsdept); function quote_smart($value) { // Stripslashes if ( get_magic_quotes_gpc() ) { $value = stripslashes( $value ); } // Quote if not a number or a numeric string if ( !is_numeric( $value ) ) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } // SET THE PAGE UP header("Content-type: text/vnd.wap.wml"); echo '<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "(URL address blocked: See forum rules)"> '; $search=<<<ASD <table align="c" columns="2"> <tr> <th ><strong>Doctor Name </strong></th> <td ><strong>Speciality</strong></td> <td ><strong>Email Address</strong></td> <td ><strong>Phone Number</strong></td> </tr> ASD; if (!$_POST) { ?> <card id="main" title="MediCare Clinic"><p> <template> <do name="menu_1" type="accept" label="Home"> <go href="#menu_tc"/> </do> <do name="menu_2" type="accept" label="Log In "> <go href="http://localhost/clic/login.php"/> </do> <do name="menu_3" type="accept" label="Find A Doctor"> <go href="http://localhost/FindADoc.php"/> </do> <do name="menu_4" type="accept" label="Make an appointment"> <go href="#makeapp"/> </do> <do name="menu_5" type="accept" label="Look up a medical term"> <go href="(URL address blocked: See forum rules)"/> </do> <do name="menu_6" type="accept" label="Health tools"> <go href="http://localhost/clic/bmi.php"/> </do> <do name="menu_7" type="accept" label="About Medi Care Clinic"> <go href="contact.wml"/> </do> <do name="menu_8" type="accept" label="Contact Us"> <go href="contactus.wml"/> </do> </template> <do type="prev" name="prev" label="Go Back"><prev/></do> <strong> </strong> <p> Find A Doctor</p> <p> You can find out about our doctors in this page. You will get their email addresses and office phone numbers. <p>Search by Department: <select name="dept" id="dept" emptyok="false"> <?php do { ?> <option value="<?php echo $row_rsdept['Departmentno']?>"<?php if (!(strcmp($row_rsdept['Departmentno'], $row_rsdept['Departmentno']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsdept['Departmentname']?></option> <?php } while ($row_rsdept = mysql_fetch_assoc($rsdept)); $rows = mysql_num_rows($rsdept); if($rows > 0) { mysql_data_seek($rsdept, 0); $row_rsdept = mysql_fetch_assoc($rsdept); } ?> </select> <p> Name: <p> <anchor> <go method="POST" href="http://localhost/clic/FindADoc.php#results"> <postfield name="dept" value="$(dept)"/> </go> Search </anchor> <anchor> <do type="reset" label="Reset"> <refresh> <setvar name="dept" value=""/> </refresh> Reset </do> </anchor> <a href="http://localhost/clic/clinicrecent.php" >Go Back</a> </p> </card> <card id="results" title="Results" > <?php } if ($_POST) { //echo "<p>Invalid operation"."<a href=\"history.back()\" >Go Back</a>"; $close_card = '</card> </wml>'; $deptid = $_POST['dept']; if (!empty($deptid)) { $sql = "SELECT * FROM doctor INNER JOIN staff ON doctor.EmployeeID = staff.Employeeid WHERE staff.Departmentno =$deptid"; This query doesnt work print($sql); $result = mysql_query($sql); if (@mysql_num_rows($result)==0) echo "<p>No records found"."<a href=\"http://localhost/FindADoc.php\" >Go Back</a>"; else { // show each doctor's record, with details. to complete while($row=@mysql_fetch_array($result)) { $search.=" <tr> <td>".$row["Employeefname"]. " " .$row["Employeelname"]."</td> <td>".$row["Speciality"]."</td> <td><a href=\"mailto:".$row["email"]."\">".$row["email"]."</a></td> <td>".$row["Phone1"]."</td> </tr>"; } $search.="</table>"; echo $search; echo $close_card; }//else }//else echo $close_card; } ?> <?php mysql_free_result($rsdept); ?> iv used a recordset which prints all the options for departments, it's supposed to print details about staff when i click on search. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Mobile Programming > Passing $_POST data with postfield (was: Hi...desperately need help) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|