Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alert Boxes 1

Status
Not open for further replies.

Sitehelp

Technical User
Feb 4, 2004
142
GB
Any ideas how you create an alert box with PHP or is that just javascript, if so how do I make my php code bring up a javascript alert box on clicking submit: I have the javascript code for it as:

<script>
<!-- Hide Script
alert(&quot;On clicking OK your call will be deleted!&quot;)
//End Hide Script-->
</script>

I cannot combine this with my form:

<form action=&quot;&quot; method=&quot;post&quot; name=&quot;CallID&quot; id=&quot;CallID&quot;>
<div align=&quot;center&quot;>
<p><strong>Call ID: </strong>
<input name=&quot;CallID&quot; type=&quot;text&quot; id=&quot;CallID&quot;>

</p>
</div>
</form>

This form also uses some PHP declared earlier to delete a record in the DB. Any ideas how I get this alert box to appear on submit. Cheers all!
 
I thought it was:

<input name=&quot;Submit&quot; type=&quot;submit&quot; onClick=&quot;&lt;script&gt;
&lt;!-- Hide Script
alert(&quot;Delete call&quot;)
//End Hide Script--&gt;
&lt;/script&gt;
&quot; value=&quot;Submit&quot;>

but it still does nothing, any ideas?
 
nono,

you make a function, put your alert in the function.
function alert()
...

onclick(alert())

like this, i think
 
like so:

Code:
<script>
<!-- Hide Script
function doConfirm() {
    return confirm(&quot;On clicking OK your call will be deleted!&quot;);
}
//End Hide Script-->
</script>

<form action=&quot;&quot; method=&quot;post&quot; name=&quot;CallID&quot; id=&quot;CallID&quot; onsubmit=&quot;return doConfirm();&quot;>
  <div align=&quot;center&quot;>
    <p><strong>Call ID: </strong>
      <input name=&quot;CallID&quot; type=&quot;text&quot; id=&quot;CallID&quot;>
    </p>
  </div>
</form>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top