Hi everyone and HAPPY NEW YEAR
:S (not sure if I am at the right place here but since I am pretty new, please don't scold me to death, just let me know and the next time ther won't be such next time, promise)

I have a simple but effective PHP FORM to manually input data into my MYSQL DB. I think about using this same form to UPDATE/DELETE entries as well.

However, before it does, I would like to be prompted with a warning, asking me if I sure want to proceed ... (sometimes I am just too fast :zzz:)

BUT, because I am not a PHP programmer I am pretty stuck on how to turn my simple submit form into an update/delete form

<input type='submit' onclick="return confirm('Do you want to make these changes ?');">

or

<form method='post|get' action='formhandlerurl' onsubmit="return confirm('Do you want to make these changes ?');">

for a prompt

<input type='submit' onclick="return confirm('Do you want to make these changes ?');">

or

<form method='post|get' action='formhandlerurl' onsubmit="return confirm('Do you want to make these changes ?');">

for a prompt

Sweet ... the simplest things we think are most complicated (leaset I think)

Thanks for that knock on my head, indeed :)

I am still working my brain out on how to code a row's data that would be displayed in a form and then I would just change any value of any field that would need to be updated ... any idea on that? I found one script online that does the first bit - but!

1 - it would fetch every single row's data of a table (with as many columns as you determine) and ...
2 - it would not update, but!

If you want, I can send you the file?

Cheers and still HAPPY NEW YEAR 2010 to you and your family

for an edit delete page
code an sql report that echos the database to the screen matching whatever you have input
eg type smith in the name field and it gives all the names like 'smith' Make the unique part of each returned row a link to output that record to your entry page populate the fields with the returned data

echo "<input type='text' name='name' value='$sqlresults['name']'>";
//repeated ad nauseum for all the fields

try this, http://www.bigprof.com/appgini/ -a php/sql code generator

Thanks and sorry for my late reply, somehow I was not able to login.

I have a form, which I use to actually insert new data and that works really fine.

On this form are 18 input fields (one entire table). Now I added one more input field that would allow me to search for a row with a specific value. Having found that row, MySQL should then populate my 18 input fields for me to view and decide which value I want to update.

You can try for by pressing the "GET" button. this should get the values and put them into the fields but it doesn't. I feel I am very close but I just can't get it together.
It connects, but it doesn't.

If you could help me out, that would be awesome and I'd pay you a dinner! :) I can send the whole page code?

Thanks so much

post the code,
i am a mysql php dabbler,
but there are gurus for whom this is easy,
likely one will slide in, answer ,

perhaps repost the same q in the mysql forum

post the code,
i am a mysql php dabbler,
but there are gurus for whom this is easy,
likely one will slide in, answer ,

perhaps repost the same q in the mysql forum

HAHA... if you are a dabbler, what am I then ??? Wish I had only a bit of your knowledge :(

Here comes my big embarrassment

<?php

include '../../parsterozza/config.php';
include '../../parsterozza/opendb.php';

$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$nickname=$_POST['nickname'];
$country_origin=$_POST['country_origin'];
$ph_country=$_POST['ph_country'];
$ph_area=$_POST['ph_area'];
$ph_home=$_POST['ph_home'];
$mobile=$_POST['mobile'];
$dob=$_POST['dob'];
$primary_email=$_POST['primary_email'];
$secondary_email=$_POST['secondary_email'];
$company=$_POST['company'];
$visa=$_POST['visa'];
$visa_expire=$_POST['visa_expire'];
$company_rego=$_POST['company_rego'];
$other=$_POST['other'];
$notes=$_POST['notes'];
$client_type=$_POST['client_type'];

$query = "INSERT INTO clients (first_name,last_name,nickname,country_origin,ph_country,ph_area,ph_home,mobile,dob,primary_email,secondary_email,company,visa,visa_expire,company_rego,other,notes,client_type) VALUES ('$first_name','$last_name','$nickname','$country_origin','$ph_country','$ph_area','$ph_home','$mobile','$dob','$primary_email','$secondary_email','company','$visa','$visa_expire','$company_rego','$other','$notes','$client_type')";
mysql_query($query);

mysql_close();
?>

<?php
include '../../parsterozza/config.php';
include '../../parsterozza/opendb.php';
//error message (not found message)begins
$XX = "No Record Found, to search again please close this window";
//query details table begins
$query = "SELECT * FROM clients WHERE $metode LIKE \"%$search%\" LIMIT 0, 50";
print($query);

mysql_query($query);
{
$variable1["first_name"];
$variable2["last_name"];
$variable3["nickname"];
$variable4["country_origin"];
$variable5["ph_country"];
$variable6["ph_area"];
$variable7["ph_home"];
$variable8["mobile"];
$variable9["dob"];
$variable10["primary_email"];
$variable11["secondary_email"];
$variable12["company"];
$variable13["visa"];
$variable14["visa_expire"];
$variable15["company_rego"];
$variable16["other"];
$variable17["notes"];
$variable18["client_type"];
}
mysql_close();
?>
<style type="text/css">
TD.text{color:#000080;}
</style>

<table width="75%" border="1" cellspacing="2" cellpadding="2">
  <form action="" method="post">
  <tr>
    <td>&nbsp;get value:</td>
    <td>&nbsp;<input type="text" title="metode" name="search"></td>
	<td><input name="" type="submit" value="get"></td>
  </tr>
	</form>
  </tr>
</table>

<table width="75%" border="1" cellspacing="2" cellpadding="2">
  <form action="update16.php" method="post">
  <tr>
    <td>&nbsp;First Name:</td>
    <td>&nbsp;<input type="text" name="first_name" value="<? echo $variable1["first_name"]; ?>"></td>
    <td class="text">&nbsp;Herman</td>
	<td><input name="reset1" type="button" value="reset1" onClick="this.form.first_name.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Last Name:</td>
    <td>&nbsp;<input type="text" name="last_name" <? echo $variable2["last_name"]; ?>"></td>
    <td>&nbsp;Geissel Gruber</td>
	<td><input name="reset2" type="button" value="reset2" onClick="this.form.last_name.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Nick Name:</td>
    <td>&nbsp;<input type="text" name="nickname" <? echo $variable3["nickname"]; ?>"></td>
    <td>&nbsp;Herby</td>
	<td><input name="reset3" type="button" value="reset3" onClick="this.form.nickname.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Country:</td>
    <td>&nbsp;<input type="text" name="country_origin" <? echo $variable4["country_origin"]; ?>"></td>
    <td>&nbsp;<font color="#FF0000">UK</font></td>
	<td><input name="reset4" type="button" value="reset4" onClick="this.form.country_origin.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Phone: Country Code</td>
    <td>&nbsp;<input type="text" name="ph_country" <? echo $variable5["ph_country"]; ?>"></td>
    <td>&nbsp;<font color="#FFOOOO">86</font></td>
	<td><input name="reset5" type="button" value="reset5" onClick="this.form.ph_country.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Phone: Area Code</td>
    <td>&nbsp;<input type="text" name="ph_area" <? echo $variable6["ph_area"]; ?>"></td>
    <td>&nbsp;<font color="#FFOOOO">755</font></td>
	<td><input name="reset6" type="button" value="reset6" onClick="this.form.ph_area.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Home Phone Number</td>
    <td>&nbsp;<input type="number" name="ph_home" <? echo $variable7["ph_home"]; ?>"></td>
    <td>&nbsp;only digits, >>><font color="#FFOOOO">12345678</font><<< no spaces</td>
	<td><input name="reset7" type="button" value="reset7" onClick="this.form.ph_home.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Mobile Phone Number:</td>
    <td>&nbsp;<input type="text" name="mobile" <? echo $variable8["mobile"]; ?>"></td>
    <td>&nbsp;only digits, >>><font color="#FFOOOO">1234567</font><<< no spaces</td>
	<td><input name="reset8" type="button" value="reset8" onClick="this.form.mobile.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Birthday:</td>
    <td>&nbsp;<input type="text" name="dob" <? echo $variable9["dob"]; ?>"></td>
    <td>&nbsp;<font color="#FF0000">1959/07/23</font></td>
	<td><input name="reset9" type="button" value="reset9" onClick="this.form.dob.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Email-1:</td>
    <td>&nbsp;<input type="email" name="primary_email" <? echo $variable10["primary_email"]; ?>"></td>
    <td>&nbsp;<font color="#FFOOOO">hmsht@goga.com</font></td>
	<td><input name="reset10" type="button" value="reset10" onClick="this.form.primary_email.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Email-2:</td>
    <td>&nbsp;<input type="email" name="secondary_email" <? echo $variable11["secondary_email"]; ?>"></td>
    <td>&nbsp;<font color="#FFOOOO">poppie@riga.com</font></td>
	<td><input name="reset11" type="button" value="reset11" onClick="this.form.secondary_email.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Company Name:</td>
    <td>&nbsp;<input type="email" name="company" <? echo $variable12["company"]; ?>"></td>
    <td>&nbsp;Enter a Company Name</td>
	<td><input name="reset12" type="button" value="reset12" onClick="this.form.company.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Visa Field:</td>
    <td>&nbsp;<input type="text" name="visa" <? echo $variable13["visa"]; ?>"></td>
    <td>&nbsp;input <font color="#FF0000">inquire</font> or visa type like <font color="#FF0000">F</font></td>
	<td><input name="reset13" type="button" value="reset13" onClick="this.form.visa.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Visa Expiry Date:</td>
    <td>&nbsp;<input type="text" name="visa_expire" <? echo $variable14["visa_expire"]; ?>"></td>
    <td>&nbsp;input <font color="#FF0000">2010/3/25</font></td>
	<td><input name="reset14" type="button" value="reset14" onClick="this.form.visa_expire.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Company Registrations:</td>
    <td>&nbsp;<input type="text" name="company_rego" <? echo $variable15["company_rego"]; ?>"></td>
    <td>&nbsp;input <font color="#FF0000">inquire</font> or company, like <font color="#FF0000">WFOE RO</font></td>
	<td><input name="reset15" type="button" value="reset15" onClick="this.form.company_rego.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Other Clients:</td>
    <td>&nbsp;<input type="text" name="other" <? echo $variable16["other"]; ?>"></td>
    <td>&nbsp;input <font color="#FF0000">inquire</font> or whatever client <font color="#FF0000">car-BMW.750</font> or <font color="#FF0000">language-Chinese</font></td>
	<td><input name="reset16" type="button" value="reset16" onClick="this.form.other.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Additional Notes:</td>
    <td>&nbsp;<input type="text" name="notes" <? echo $variable7["notes"]; ?>"></td>
    <td>&nbsp;Add any "inquiry" or client notes here without restrictions</td>
	<td><input name="reset16" type="button" value="reset16" onClick="this.form.notes.value='';"></td>
  </tr>
  <tr>
    <td>&nbsp;Client Field:</td>
    <td>&nbsp;<input type="text" name="client_type" <? echo $variable8["client_type"]; ?>"></td>
    <td>&nbsp;Indicate client status like;<font color="#FF0000">r,y,n,d</font></td>
	<td><input name="reset16" type="button" value="reset16" onClick="this.form.client_type.value='';"></td>
  </tr>
  <tr>
    <td></td><td align="right"><input name="" type="submit" value="insert"></td><td align="center"><input name="" type="reset" value="reset all"></td>
  </tr>
	</form>
  </tr>
</table>

If I put the same into the MySQL forum wouldn't I violate the rules for double posting ..? I wish I would be allowed. What is your experience.

I am a freshman ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.