Jump to content

Recommended Posts

this doesn't work. i want the form action to go the location.href of the submit button chosen.. how do i do this?

 

  <?php
   echo "<form enctype='multipart/form-data' action='location.href' method='post' name='changer'>
   
   <table width='376' height='76' border='0'>      
<tr>
<td>
 <font color=white font face=Verdana>Subject: </font><input type='text' name='keywords' value=''>
</td>
</tr>
	<tr>
          <td align='center'><input type='submit' name='Add Webpage' id='Add Webpage' value='Add Webpage' onClick='location.href=\"stacker.php\"'></td>
          <td align='center'><input type='submit' name='Add Topice' id='Add Topic' value='Add Topic' onClick='location.href=\"uinfo.php\"'></td>
          <td align='center'><input type='submit' name='Add Image' id='Add Image' value='Add Image' onClick='location.href=\"uimage.php\"'></td>
        </tr>
      

      </table></form>"; ?>

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/
Share on other sites

you see where it says action='location.href' will the form work? meaning will it send the value "keyword" to the submit button(page) chosen?

 

  <?php
   echo "<form enctype='multipart/form-data' action='location.href' method='post' name='changer'>
   
   <table width='376' height='76' border='0'>      
<tr>
<td>
 <font color=white font face=Verdana>Subject: </font><input type='text' name='keywords' value=''>
</td>
</tr>
	<tr>
          <td align='center'><input type='submit' name='Add Webpage' id='Add Webpage' value='Add Webpage' onClick='location.href=\"stacker.php\"'></td>
          <td align='center'><input type='submit' name='Add Topice' id='Add Topic' value='Add Topic' onClick='location.href=\"uinfo.php\"'></td>
          <td align='center'><input type='submit' name='Add Image' id='Add Image' value='Add Image' onClick='location.href=\"uimage.php\"'></td>
        </tr>
      

      </table></form>"; ?>

 

sorry - to get the input token 'keyword' sent, you need to either use separate forms for each submit button, or remove the form tag and hidden field entirely, and encode a get url for each button...

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/#findComment-992524
Share on other sites

ok.. i changed it to 3 seperate forms.. how do i post the keywords for whatever form chosen, without displaying 3 input boxes for keywords.

 

i'm thinking 4 input text fields(3 invisible) and typing in the first input text field types in the invisible textfields? so the question now is how do i input into multiple input text fields at the same time?

 

<?php
   echo "
   
   <table width='600' height='76' border='0'>      
<tr>
<td align='center' colspan='3'>
 <font color=white face=Arial color=#FBB917><strong>Subject: </strong></font><input type='text' name='keywords' value=''>
</td>
</tr>
	<tr>
          <td align='center'>
	  <form enctype='multipart/form-data' action='stacker.php' method='post' name='changer'><input type='submit' name='Add Webpage' id='Add Webpage' value='Add Webpage' ></form></td>
          <td align='center'> <form enctype='multipart/form-data' action='uinfo.php' method='post' name='changer'><input type='submit' name='Add Topice' id='Add Topic' value='Add Topic' ></form></td>
          <td align='center'> <form enctype='multipart/form-data' action='uimage.php' method='post' name='changer'><input type='submit' name='Add Image' id='Add Image' value='Add Image' ></form></td>
        </tr>
      

      </table>"; ?>

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/#findComment-992527
Share on other sites

use javascript -

 

<script type="text/javascript">
function setForms(data) {
   document.form1.keywords.value = data;
   document.form2.keywords.value = data;
   ....
}
</script>
<form name="form1"...>
<input type="hidden" name="keywords" value=""/>
<input type="submit"...>
</form>
<form name="form2"...>
<input type="hidden" name="keywords" value=""/>
<input type="submit"..>
</form>
... (other forms)

(actual keywords entry box)
<input type="text" name="keywords_entry" value=""  onchange="setForms(this.value);">

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/#findComment-992530
Share on other sites

i tried doesn't work though.. i made the boxes visible to test, they don't fill up?  problem with javascript?

 

 <script type="text/javascript">
function setForms(data) {
   document.changer1.keywords.value = data;
   document.changer2.keywords.value = data;
   document.changer3.keywords.value = data;
}
</script>
 <?php
   echo "
   
   <table width='600' height='76' border='0'>      


	<tr>

          <td align='center'>
	  <form enctype='multipart/form-data' action='stacker.php' method='post' name='changer1'><input type='text' name='keywords' value=''><input type='submit' name='Add Webpage' id='Add Webpage' value='Add Webpage' ></form></td>

          <td align='center'> <form enctype='multipart/form-data' action='uinfo.php' method='post' name='changer2'><input type='text' name='keywords' value=''><input type='submit' name='Add Topice' id='Add Topic' value='Add Topic' ></form></td>

          <td align='center'> <form enctype='multipart/form-data' action='uimage.php' method='post' name='changer3'><input type='text' name='keywords' value=''><input type='submit' name='Add Image' id='Add Image' value='Add Image' ></form></td>

        </tr>
      <tr>
<td align='center' colspan='3'>
 <font color=white face=Arial color=#FBB917><strong>Subject: </strong></font><input type='text' name='keywords_entry' value=''  onchange='setForms(this.value);'>

</td>
</tr>

      </table>"; ?>

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/#findComment-992570
Share on other sites

i tried doesn't work though.. i made the boxes visible to test, they don't fill up?  problem with javascript?

 

 <script type="text/javascript">
function setForms(data) {
   document.changer1.keywords.value = data;
   document.changer2.keywords.value = data;
   document.changer3.keywords.value = data;
}
</script>
 <?php
   echo "
   
   <table width='600' height='76' border='0'>      


	<tr>

          <td align='center'>
	  <form enctype='multipart/form-data' action='stacker.php' method='post' name='changer1'><input type='hidden' name='keywords' value=''><input type='submit' name='Add Webpage' id='Add Webpage' value='Add Webpage' ></form></td>

          <td align='center'> <form enctype='multipart/form-data' action='uinfo.php' method='post' name='changer2'><input type='hidden' name='keywords' value=''><input type='submit' name='Add Topice' id='Add Topic' value='Add Topic' ></form></td>

          <td align='center'> <form enctype='multipart/form-data' action='uimage.php' method='post' name='changer3'><input type='hidden' name='keywords' value=''><input type='submit' name='Add Image' id='Add Image' value='Add Image' ></form></td>

        </tr>
      <tr>
<td align='center' colspan='3'>
 <font color=white face=Arial color=#FBB917><strong>Subject: </strong></font><input type='text' name='keywords_entry' value=''  onchange='setForms(this.value);'>

</td>
</tr>

      </table>"; ?>

 

Hide the input controls for the form.  Please remember that the onchange event on the visible text field doesn't fire until that text field loses focus.  I.e. when the user types something in, and hits one of the submit buttons, the 'keywords' value for all submit buttons are changed to the text field's value, and then the submit button that is clicked on submits its form.

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/#findComment-992578
Share on other sites

Jumping in a bit late but I think you are overly complicating the thing. Why not have one form with the keywords input and a select/option box with what you want in the submits. Then your action goes to a controller page that redirects to the various php pages.

 

 

HTH

Teamatomic

Link to comment
https://forums.phpfreaks.com/topic/188000-form-help/#findComment-992585
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.