Jump to content

Recommended Posts

This is a sript that runs on a wap phone. It works okay except it inserts a few blank records into the database as well as the one record I want to insert. Any ideas whats wrong.

<?php

  
  $query = "SELECT t1.waterway_name, t1.waterway_id  FROM waterways=t1 WHERE t1.waterway_initals = 'LB'";
  
  $result = mysql_query($query, $dbhandle);
  if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
print ("<select name=\"choice\" value=\"1\" title=\"Waterway\">");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){
	print ("<option value = \"$line[waterway_id]\"> $line[waterway_name] </option>");
  	}
  	print ("</select>");
  	print ("<do type = \"Accept\" label = \"Report problem\">");
print ("<go method=\"get\" href = \"#card7\"><postfield name =\"choice\" value=\"$(choice)\" />");
print ("</go>");
print ("</do>");
?>
</p>
</card>

<card id = "card7" title = "Report">
<p><em>Waterways Reports</em><br/></p>
<p>
<small>
Description:
<input name = "description" maxlenght = "12" />
Severity 1-2:
<input name = "severity" format = "N" />
Member Id:
<input name = "memberid" value = "$username" maxlenght = "12" />
</small>
</p>
<do type = "Accept" label = "">
<go method="get" href = "#card8"><postfield name ="description" value="$(description)" /><postfield name ="severity" value="$(severity)" /><postfield name ="memberid" value="$(memberid)" /><postfield name ="wwid" value="$(wwid)" />
</go>
</do>
</card>

<card id = "card8" title = "Report">
<?php
$desc = "$_GET[description]";
$sev = "$_GET[severity]";
$memid = "$_GET[memberid]";
$ww_id = "$_GET[choice]";
$query = "Insert Into pending_problems (problem_desc, problem_severity, waterway_id, member_id)";
$query .= "Values ('$desc', '$sev', '$ww_id', '$memid')";

$result = mysql_query($query, $dbhandle);

//mysql_close($dbhandle);
print ("$ww_id");
?>
<p>
<em>Problem Added.</em><br />
<a accesskey = "1" href = "ww_select.wml#index" title = "Main Menu">Main Menu</a>
</p>
</wml>

Link to comment
https://forums.phpfreaks.com/topic/44804-wml-php/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.