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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Form + Iframes + Uploading Pictures 1

Status
Not open for further replies.

Kharas

Programmer
Jan 30, 2007
39
MX
Well, I'm working on a formulary to help the low-tech-level employees of the company be able to update the forklift database without the knowledge of FTP or html/php, etc.

So I made a web based formulary that has dynamic and static menu/lists plus text fields. So far so good. And then the time came for the images.

How does someone with no possible FTP comprenhension upload in image to the server and then add the image url to the formulary? No way.

So what I'm trying to do right now is mix both my formulary with an image uploading code somebody lent me, which I adapted.

is such uploading code
is the formulary with 'preupload.php' put inside an IFRAME to the right.

Now my question is the following:

How do I grab the image urls inside 'preupload.php' within the iframe and have them pasted on the image url text fields on the left (like if the employee had actually written it) ???

Thanks in advance
 
I would modify admin_mont_insert.php so that instead of outputting a reference to preupload.php in an <IFRAME>, the fields output by preupload.php would be output in a subtable. One submit button, one form.


Want the best answers? Ask the best questions! TANSTAAFL!
 
I forgot to explain preupload.php sends the data to upload.php to be processed. Within upload.php the following code was put and the image url was put as desired: (A million thanks to Bastien for this!!)

$result_final .= "<img src='".$images_dir. "/tb_".$filename."' /> File ".($counter+1)." Added URL equals ".$url."<br /><script>parent.document.getElementById(\"img_url".($counter+1)."\").value = \"$url\";</script>";

Now, the text fields on the left are named img_url1 and img_url2 respectively so they can adapt to the counter-based variable defining.

Go to and try it for yourself.
 
I'm correcting the flaws in the insertion of new records and further edition.

Within my SQL Query can I add values to the WHERE Clause such as &(a,e,i,o,u)cute; (&aacute;,&eacute;,&iacute;,&oacute;,&uacute;) ?????

I've tried the following:

1 - "SELECT * FROM tbl_montac WHERE categoria = 'El&eacute;ctricos'

2 - $var = El&eacute;ctricos
"SELECT * FROM tbl_montac WHERE categoria = ".$var."";

Same as above but changing the var defining

3 - $var = 'El&eacute;ctricos'
4 - $var = "El&eacute;ctricos"
5 - $var = Eléctricos
6 - $var = 'Eléctricos'
7 - $var = "Eléctricos"

No luck =(

 
Exactly that : El&eacute;ctricos or Combusti&oacute;n
 
Then you should be able to get the data you need with a query which reads:

SELECT * FROM tbl_montac WHERE categoria = 'El&eacute;ctricos'

One workaround, however, is to have a table which looks something like:

1 El&eacute;ctricos
2 Combusti&oacute;n

Then store just in the number in tbl_montac. You can use that number in your <SELECT>s and queries:

<select name="categoria" id="categoria">
<option value="1" selected="selected">El&eacute;ctricos</option>
<option value="2">Combusti&oacute;n</option>
and

SELECT * FROM tbl_montac WHERE categoria = 1

The second table also can make your form more data-driven: if the script that produces your form populates the select from this second table, all you have to do is add a new catetory to the table for it to automatically appear in your <select>.


Want the best answers? Ask the best questions! TANSTAAFL!
 
<< SELECT * FROM tbl_montac WHERE categoria = 'El&eacute;ctricos' >> Did NOT work =/

I like the workaround, but with all the accents in the spanish language, this could lead to having too many tables of that kind.

Bastien said something about making the table recognize ASCII extended characters, I don't know how that is done though.
 
Just one table for each category. You'd need one table, regardless of the number of categories in your system.

Yes, I'd recommend a table to store possible values for you r "type", "Brand", "Battery information", etc., <select>s with the appropriate integers stored in your main table.


Want the best answers? Ask the best questions! TANSTAAFL!
 
Alright then. Case closed, now on to my next problem =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top