Jump to content

running mysql query in php


sofia403

Recommended Posts

Hi i was wondering what im doing wrong, im trying to insert a query for submit button, it works if i run it straight in mysql, but not working when linked through php. Im just doing it for testing purpose right now only, so when i see that it works i will use another query.

 

here it is

 

<?php 
include('config.php');
if($_SESSION['username']){
if(isset($_POST['ASubmit'])){
$query3=("update country set Status='test1' where Uname='Mclovin'");}

echo '<td><form name="test" method="post" form id="form1"><label for="test">Status</label>
	<select name="Status">
	<option value="">-----</option>
	<option value="In process" '.(($row['Status']=='In process')?'selected="selected"':'').'>In process</option>
	<option value="Approved" '.(($row['Status']=='Approved')?'selected="selected"':'').'>Approved</option>
	<option value="Denied" '.(($row['Status']=='Denied')?'selected="selected"':'').'>Denied</option>
        </select><input name="ASubmit" type="submit" value="Update">'; echo $row{'Status'}.'</td></form>';
}
?>

Link to comment
Share on other sites

Looks like you are also missing the action=\"processingpage.php\" on your form.  If Just checking things out on the same page you can use the # sign.

<form name=\"test\" method=\"post\" form id=\"form1\" action=\"#\" />

 

You also have nesting issue by placing </form> tag outside </td>.

Link to comment
Share on other sites

what is processingpage.php? i dont have that at all.
Read... what is the form supposed to do or where is it being processed.  The action directs the form to the page where it is being processed.  I said, you can use the # if being processed on the same page or you can put the actual page name in there.
Link to comment
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.