Jump to content

PHP form in WordPress wysiwyg - select onchange this.form.submit error


Recommended Posts

Hello, first time poster..  I've looked the web over for a long time and can't figure this one out.


- Below is basic code that successfully checks MySQL for a match and displays result.  I was debugging and forced the "height" and "width" to be 24 and 36 to make sure that wasn't the problem.  That's good.. 

- I'd like to give the user ability to select width and height from a form.. and have it do an onchange this.form.submit so the form can be changing as fields are altered (thus the onchange interaction)

- In a normal coding environment I've done this numerous times with no "Page cannot be displayed" problems.  It would simply change one select-option value at a time til they get down the form and click submit...  but in WordPress I'm having trouble making even ONE single onchange work!

- I've implemented the plugins they offer which allows you to "copy+paste" your php code directly into their wysiwyg editor.  That works with basic tests like my first bullet point above.

- I've copied and pasted the wordpress url (including the little ?page_id=123) into the form "action" url... that didn't work...  tried forcing it into an <option value=""> tag.. didn't work.  I'm just not sure. 


I've obviously put xx's in place of private info..


Why does this form give me Page Cannot Be Displayed in WordPress every time?  It won't do anything no matter how simple.. using onchange..



$con = mysql_connect("xxxx.xxxxxxx.com","xxxxxx","xxxxx");
if (!$con)
  die('Could not connect: ' . mysql_error());
mysql_select_db("xxxxxx", $con);
$result = mysql_query("SELECT * FROM product_sizes WHERE prodwidth='$myprodwidth' and prodheight='$myprodheight'");
while($row = mysql_fetch_array($result))
  echo $row['prodprice'];


<form method="post" action="">

<select name="myheight" onchange="this.form.submit();">

<option selected="selected" value="">select height</option>

<option value="xxxxxxxxx.com/wordpress/?page_id=199&height=36">36</option>

<option value="xxxxxxxxx.com/wordpress/?page_id=199&height=36">48</option>



Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

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

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.