Jump to content

[SOLVED] if statement in onclick event


matthewst

Recommended Posts

It always says "nothing in text box"

 

<input type="text" class="formSmallTextbox" name="a_number" size="4" value="<?="$a_number"?>">

 

<input type="submit" name="submit" class="formTextbox" value="Submit" onClick="<?php
if ($qty_oak >= '1'){
echo "return confirm('something in text box')\">";}				else{
echo "return confirm('nothing in text box')\">";}
?>

Link to comment
https://forums.phpfreaks.com/topic/55098-solved-if-statement-in-onclick-event/
Share on other sites

thanks raffels (sitepoint)

 

<input type="text" class="formSmallTextbox" name="a_number" size="4" value="">

<input type="submit" name="submit" class="formTextbox" value="Submit" onClick="if (document.getElementsByName('a_number')[0].value == '') return confirm('nothing in text box'); else return confirm('something in textbox');">

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.